Javascript blackmails because you don’t know its truth. Test how much truth you know.
Quiz 1 –
(function f(){
function f(){ return 1; }
return f();
function f(){ return 2; }
})();
Quiz 2 –
(function f(){
var f = function() { return 1; }
return f();
var f = function() { return 2; }
})();
Quiz 3 –
(function(foo){
return typeof foo.bar;
})({ foo: { bar: 1 } });
Quiz 3 –
(function(foo){
return typeof foo.foo.bar;
})({ foo: { bar: 1 } });
Quiz 4 –
(function f(){
var f = function() { return 1; }
return f();
function f() { return 2; }
})();
Quiz 5 –
(function f(){
function f() { return 2; }
return f();
var f = function() { return 1; }
})();
Quiz 6 –
(function f(){
return f();
var f = function() { return 1; }
})();
Quiz 7 –
(function f(){
return f();
var f = function() { return 1; }
function f() { return 2; }
})();
Quiz 8 –
typeof undefined
Quiz 9 –
typeof typeof undefined
Quiz 10 –
[typeof x, typeof y][1];
Quiz 11 –
var x = 1;
if (function f(){}) {
x += typeof f;
}
x;
Quiz 12 –
1 + undefined
Quiz 13 –
var x = (1, 2, 3);
x
Quiz 14 –
var x = 10;
function z(){
var a = x = 20;
console.log(a);
}
z();
console.log(x);
Quiz 15 –
var x = 10;
function z(){
var x = x = 20;
console.log(x);
}
z();
console.log(x);
Quiz 16 –
true + false + true > true - false
Quiz 17 –
typeof true + false + true
Quiz 18 –
-'-1'
Quiz 19 –
-'-a'
Quiz 20 –
1 + '1'
Quiz 21 –
+ '1'
Quiz 22 –
function b(x, y, a) {
arguments[2] = 10;
alert(a);
}
b(1, 2, 3);

Nice
function b(x, y, a) {
arguments[2] = 10;
alert(a);
}
b(1, 2, 3);
Can you explain this??
read this article to understand the above concept – http://davidshariff.com/blog/what-is-the-execution-context-in-javascript/#first-article
Excellent set of questions