Created
July 31, 2017 02:55
-
-
Save thebopshoobop/c4c1d3b0931947d10f113114e03b6aee to your computer and use it in GitHub Desktop.
This file contains 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
// This version throws a ReferenceError | |
function foo() { | |
console.log(x); | |
} | |
// These versions are equivalent and both log undefined | |
function bar() { | |
console.log(x); | |
var x = 'ZORG'; | |
} | |
function baz() { | |
var x; | |
console.log(x) | |
x = 'ZORG'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment