Created
May 5, 2017 07:05
-
-
Save ykarikos/94b4fdb3136f205d40e0f7f8a16bdf2a to your computer and use it in GitHub Desktop.
What does each logging statement print, why?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// What does each logging statement print, why? | |
var x = 1; | |
console.log(x); | |
if(1) { | |
var x = 2; | |
console.log(x); | |
} | |
console.log(x); | |
var x = 10; | |
function foo(x) { | |
if(!x) { | |
x = 4; | |
} | |
console.log(x, arguments); | |
}; | |
foo.call(7); | |
var foo = (function() { | |
console.log(x); | |
})(); | |
foo(5); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment