+
JavaScript Quizz
Rémi Goyard - @mimiz33 - 2014
JS
+
What will be logged ?
function foo() {
console.log(x);
var x = 10;
}
foo();
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
function foo() {
console.log(x);
var x = 10;
}
foo();
 UNDEFINED !
Rémi Goyard - @mimiz - www.mim...
+
What will be logged ?
function bar(){
foo();
var foo = function() {
console.log(99);
};
}
bar();
Rémi Goyard - @mimiz - ...
+
What will be logged ?
function bar(){
foo();
var foo = function() {
console.log(99);
};
}
bar();
 TypeError:
 foo is n...
+
What will be logged ?
var a = 5;
function first() {
a = 6;
}
function second() {
console.log(a);
}
first();
second();
Ré...
+
What will be logged ?
var a = 5;
function first() {
a = 6;
}
function second() {
console.log(a);
}
first();
second();
 ...
+
What will be logged ?
function getFunc() {
var a = 7;
return function(b) {
console.log(a+b);
}
}
var f = getFunc();
f(5)...
+
What will be logged ?
function getFunc() {
var a = 7;
return function(b) {
console.log(a+b);
}
}
var f = getFunc();
f(5)...
+
What will be logged ?
function func() {
return
"truc";
}
console.log(func());
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
function func() {
return
"truc";
}
console.log(func());
 UNDEFINED
Rémi Goyard - @mimiz - www.mim...
+
What will be logged ?
var x = 5;
var o = {
x: 10,
doIt: function doIt(){
var x = 20;
console.log(this.x);
}
};
o.doIt();...
+
What will be logged ?
var x = 5;
var o = {
x: 10,
doIt: function doIt(){
var x = 20;
console.log(this.x);
}
};
o.doIt();...
+
What will be logged ?
var x = 5;
var o = {
x: 10,
doIt: function doIt(){
var x = 20;
setTimeout(function(){
console.log(...
+
What will be logged ?
var x = 5;
var o = {
x: 10,
doIt: function doIt(){
var x = 20;
setTimeout(function(){
console.log(...
+
What will be logged ?
var a = 5;
function() {
var a = 7;
console.log(a);
}
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
var a = 5;
function() {
var a = 7;
console.log(a);
}
 7
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
(function() {
var kittySays = "Meow";
})();
console.log(kittySays);
Rémi Goyard - @mimiz - www.mim...
+
What will be logged ?
(function() {
var kittySays = "Meow";
})();
console.log(kittySays);
 ReferenceError:
 kittySays ...
+
What will be logged ?
var x = 15, y = 10;
console.log(x++-++y);
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
var x = 15, y = 10;
console.log(x++-++y);
 4
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
var x = 15, y = 10;
console.log(x++-++y+x++);
Rémi Goyard - @mimiz - www.mimiz.fr
+
What will be logged ?
var x = 15, y = 10;
console.log(x++-++y+x++);
 20
Rémi Goyard - @mimiz - www.mimiz.fr
+
What is the answer ?
(function f(f) {
return typeof f();
})(function(){ return 1; });
 number
 undefined
 function
 ...
+
What is the answer ?
(function f(f) {
return typeof f();
})(function(){ return 1; });
 number
 undefined
 function
 ...
+
What is the answer ?
var foo = {
bar: function() { return this.baz;
},
baz: 1
};
(function(){
return typeof arguments[0]...
+
What is the answer ?
var foo = {
bar: function() { return this.baz;
},
baz: 1
};
(function(){
return typeof arguments[0]...
+
What is the answer ?
function bar() {
return foo;
foo = 10;
function foo() {}
var foo = '11';
}
console.log(typeof bar()...
+
What is the answer ?
function bar() {
return foo;
foo = 10;
function foo() {}
var foo = '11';
}
console.log(typeof bar()...
+ Javascript Quizz
 Feel free to send me your feedback :
 @mimiz33
 http://www.mimiz.fr
 About Me
 http://fr.linkedin...
Upcoming SlideShare
Loading in …5
×

JavaScript Quizz 2014

974 views

Published on

Just a Little JavaScript Quizz

Published in: Technology

JavaScript Quizz 2014

  1. 1. + JavaScript Quizz Rémi Goyard - @mimiz33 - 2014 JS
  2. 2. + What will be logged ? function foo() { console.log(x); var x = 10; } foo(); Rémi Goyard - @mimiz - www.mimiz.fr
  3. 3. + What will be logged ? function foo() { console.log(x); var x = 10; } foo();  UNDEFINED ! Rémi Goyard - @mimiz - www.mimiz.fr
  4. 4. + What will be logged ? function bar(){ foo(); var foo = function() { console.log(99); }; } bar(); Rémi Goyard - @mimiz - www.mimiz.fr
  5. 5. + What will be logged ? function bar(){ foo(); var foo = function() { console.log(99); }; } bar();  TypeError:  foo is not a function Rémi Goyard - @mimiz - www.mimiz.fr
  6. 6. + What will be logged ? var a = 5; function first() { a = 6; } function second() { console.log(a); } first(); second(); Rémi Goyard - @mimiz - www.mimiz.fr
  7. 7. + What will be logged ? var a = 5; function first() { a = 6; } function second() { console.log(a); } first(); second();  6 Rémi Goyard - @mimiz - www.mimiz.fr
  8. 8. + What will be logged ? function getFunc() { var a = 7; return function(b) { console.log(a+b); } } var f = getFunc(); f(5); Rémi Goyard - @mimiz - www.mimiz.fr
  9. 9. + What will be logged ? function getFunc() { var a = 7; return function(b) { console.log(a+b); } } var f = getFunc(); f(5);  12 Rémi Goyard - @mimiz - www.mimiz.fr
  10. 10. + What will be logged ? function func() { return "truc"; } console.log(func()); Rémi Goyard - @mimiz - www.mimiz.fr
  11. 11. + What will be logged ? function func() { return "truc"; } console.log(func());  UNDEFINED Rémi Goyard - @mimiz - www.mimiz.fr
  12. 12. + What will be logged ? var x = 5; var o = { x: 10, doIt: function doIt(){ var x = 20; console.log(this.x); } }; o.doIt(); Rémi Goyard - @mimiz - www.mimiz.fr
  13. 13. + What will be logged ? var x = 5; var o = { x: 10, doIt: function doIt(){ var x = 20; console.log(this.x); } }; o.doIt();  10 Rémi Goyard - @mimiz - www.mimiz.fr
  14. 14. + What will be logged ? var x = 5; var o = { x: 10, doIt: function doIt(){ var x = 20; setTimeout(function(){ console.log(this.x); }, 10); } }; o.doIt(); Rémi Goyard - @mimiz - www.mimiz.fr
  15. 15. + What will be logged ? var x = 5; var o = { x: 10, doIt: function doIt(){ var x = 20; setTimeout(function(){ console.log(this.x); }, 10); } }; o.doIt();  5 Rémi Goyard - @mimiz - www.mimiz.fr
  16. 16. + What will be logged ? var a = 5; function() { var a = 7; console.log(a); } Rémi Goyard - @mimiz - www.mimiz.fr
  17. 17. + What will be logged ? var a = 5; function() { var a = 7; console.log(a); }  7 Rémi Goyard - @mimiz - www.mimiz.fr
  18. 18. + What will be logged ? (function() { var kittySays = "Meow"; })(); console.log(kittySays); Rémi Goyard - @mimiz - www.mimiz.fr
  19. 19. + What will be logged ? (function() { var kittySays = "Meow"; })(); console.log(kittySays);  ReferenceError:  kittySays is not defined Rémi Goyard - @mimiz - www.mimiz.fr
  20. 20. + What will be logged ? var x = 15, y = 10; console.log(x++-++y); Rémi Goyard - @mimiz - www.mimiz.fr
  21. 21. + What will be logged ? var x = 15, y = 10; console.log(x++-++y);  4 Rémi Goyard - @mimiz - www.mimiz.fr
  22. 22. + What will be logged ? var x = 15, y = 10; console.log(x++-++y+x++); Rémi Goyard - @mimiz - www.mimiz.fr
  23. 23. + What will be logged ? var x = 15, y = 10; console.log(x++-++y+x++);  20 Rémi Goyard - @mimiz - www.mimiz.fr
  24. 24. + What is the answer ? (function f(f) { return typeof f(); })(function(){ return 1; });  number  undefined  function  Error Rémi Goyard - @mimiz - www.mimiz.fr
  25. 25. + What is the answer ? (function f(f) { return typeof f(); })(function(){ return 1; });  number  undefined  function  Error Rémi Goyard - @mimiz - www.mimiz.fr
  26. 26. + What is the answer ? var foo = { bar: function() { return this.baz; }, baz: 1 }; (function(){ return typeof arguments[0](); })(foo.bar);  undefined  object  Number  function Rémi Goyard - @mimiz - www.mimiz.fr
  27. 27. + What is the answer ? var foo = { bar: function() { return this.baz; }, baz: 1 }; (function(){ return typeof arguments[0](); })(foo.bar);  undefined  object  Number  function Rémi Goyard - @mimiz - www.mimiz.fr
  28. 28. + What is the answer ? function bar() { return foo; foo = 10; function foo() {} var foo = '11'; } console.log(typeof bar());  number  function  undefined  string  Error Rémi Goyard - @mimiz - www.mimiz.fr
  29. 29. + What is the answer ? function bar() { return foo; foo = 10; function foo() {} var foo = '11'; } console.log(typeof bar());  number  function  undefined  string  Error Rémi Goyard - @mimiz - www.mimiz.fr
  30. 30. + Javascript Quizz  Feel free to send me your feedback :  @mimiz33  http://www.mimiz.fr  About Me  http://fr.linkedin.com/in/remigoyard  http://cv.remi-goyard.com This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License. Rémi Goyard - @mimiz - www.mimiz.fr

×