Last active
May 23, 2016 16:42
-
-
Save wolfieorama/34bed77d163c1fbb62cd0d04fb43f68a 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 testClosure (){ | |
var x = 4; // local variable | |
return x; | |
} | |
testClosure(); // this will return 4 | |
x; // will return undefined because a function variable are not available once the scope has closed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment