Skip to content

Instantly share code, notes, and snippets.

@dmjio
Created August 17, 2011 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dmjio/1152858 to your computer and use it in GitHub Desktop.
Save dmjio/1152858 to your computer and use it in GitHub Desktop.
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