Created
September 23, 2016 20:16
-
-
Save domfarolino/60ea2d2846425375581434bea12a40d8 to your computer and use it in GitHub Desktop.
1st example explaining closures to Pat
This file contains 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
var outerFunction = function(outerFunctionState) { | |
var innerFunction = function() { | |
console.log("Snapshot of the outerFunction's state is: " + outerFunctionState); | |
} | |
return innerFunction; | |
} | |
var generatedFunction1 = outerFunction(5); | |
var generatedFunction2 = outerFunction(10); | |
generatedFunction1(); | |
generatedFunction2(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment