Skip to content

Instantly share code, notes, and snippets.

@zealinux
Created September 8, 2013 12:19
Show Gist options
  • Save zealinux/6484325 to your computer and use it in GitHub Desktop.
Save zealinux/6484325 to your computer and use it in GitHub Desktop.
function makeAdder(x) {
return function(y) {
return x + y;
};
}
var add5 = makeAdder(5);
var add10 = makeAdder(10);
print(add5(2)); // 7
print(add10(2)); // 12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment