Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.