Created
February 7, 2016 01:31
-
-
Save josescasanova/aa2aa0b7db857d5f194b to your computer and use it in GitHub Desktop.
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
function setGlobal() { | |
a = 42; | |
} | |
function setLocal() { | |
var b = 23; | |
} | |
setGlobal(); | |
alert(a); // 42 | |
setLocal(); | |
alert(b); // ReferenceError: b is not defined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment