Skip to content

Instantly share code, notes, and snippets.

@lyuehh
Created January 26, 2013 10:19
Show Gist options
  • Save lyuehh/4641542 to your computer and use it in GitHub Desktop.
Save lyuehh/4641542 to your computer and use it in GitHub Desktop.
function add_1(x, y) {
return x + y;
}
console.log(add_1(1,2));
function add(x, y) {
var oldx = x, oldy = y;
if(typeof y === 'undefined') {
return function(newy) {
return oldx + newy;
};
}
return x + y;
}
console.log(add(1,2));
console.log(add(1)(2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment