Skip to content

Instantly share code, notes, and snippets.

@jeremyckahn
Last active December 17, 2015 19:09
Show Gist options
  • Select an option

  • Save jeremyckahn/5658189 to your computer and use it in GitHub Desktop.

Select an option

Save jeremyckahn/5658189 to your computer and use it in GitHub Desktop.
Tutoring notes — 5/27/2013
var increment = (function () {
var foo = 1;
return function () {
return foo++;
};
} ());
increment();
increment();
increment();
///////
var makeIncrementer = function () {
var foo = 1;
return function () {
return foo++;
};
};
var incrementer1 = makeIncrementer();
var incrementer2 = makeIncrementer();
incrementer1(); // 2
incrementer1(); // 3
incrementer2(); // 2
incrementer2(); // 3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment