Created
August 17, 2011 22:57
-
-
Save dmjio/1152858 to your computer and use it in GitHub Desktop.
GetIncrementFunction
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 GetIncrementFunc(incBy) | |
{ | |
var temp = 0; | |
return function() { temp += incBy; return temp; } | |
} | |
var c = GetIncrementFunc(3); | |
document.write(c()); | |
document.write(c()); | |
document.write(c()); | |
//Output - 3,6,9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment