Skip to content

Instantly share code, notes, and snippets.

@dmjio
Created Aug 17, 2011
Embed
What would you like to do?
GetIncrementFunction
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