Skip to content

Instantly share code, notes, and snippets.

@codeaholicguy
Created December 30, 2015 09:38
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 codeaholicguy/8ca74b3d1235fe37acf9 to your computer and use it in GitHub Desktop.
Save codeaholicguy/8ca74b3d1235fe37acf9 to your computer and use it in GitHub Desktop.
function sayHello(){
var message = 'Hello'; // define a local variable.
return function(){ // return a function from sayHello.
console.log(message); // wanna know if 'message' still in scope?
}
}
var helloSayer = sayHello();
helloSayer(); // call the inner function returned from sayHello.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment