Created
September 1, 2013 14:54
-
-
Save metasansana/6404937 to your computer and use it in GitHub Desktop.
Javascript closure
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
function outer (outerArg) { | |
return function (innerArg) { // closure function | |
return outerArg+innerArg; | |
}; | |
} | |
//Usage | |
var result = outer(1)(2); // result will be equal to 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment