Skip to content

Instantly share code, notes, and snippets.

@praveen-me
Created September 6, 2018 05:05
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 praveen-me/5dcbf7f4b88b4409f0e0deade640da87 to your computer and use it in GitHub Desktop.
Save praveen-me/5dcbf7f4b88b4409f0e0deade640da87 to your computer and use it in GitHub Desktop.
Scopes in JavsScript
var num1 = 5; //globally
function add() {
var num2 = 8; //locally
return function() { //returning function
return num1 + num2; //returning function
} //returning function
}
var addIt = add();
addIt(); //?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment