Skip to content

Instantly share code, notes, and snippets.

@shellsong
Created September 27, 2013 08:39
Show Gist options
  • Save shellsong/6725727 to your computer and use it in GitHub Desktop.
Save shellsong/6725727 to your computer and use it in GitHub Desktop.
function plus(n,r){
var result = r||0;
result+=n;
function add(n){
return plus(n,result)
}
add.toString = function(){
return result;
}
return add;
}
console.log(plus(1)(2)(3))
console.log(plus(1)(100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment