function currying(fn){ var args = Array.prototype.slice.call(arguments, 1); return function(){ var newArgs = args.concat(Array.prototype.slice.call(arguments)); return fn.apply(this, newArgs); } } function add(x, y){ return x + y; } //var d = currying(add, 2)(3); var d = add(1)(2); console.log(d);
原文:https://www.cnblogs.com/jiajiaobj/p/13654849.html