Skip to content

Instantly share code, notes, and snippets.

@wolfieorama
Last active May 23, 2016 16:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wolfieorama/34bed77d163c1fbb62cd0d04fb43f68a to your computer and use it in GitHub Desktop.
Save wolfieorama/34bed77d163c1fbb62cd0d04fb43f68a to your computer and use it in GitHub Desktop.
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