1 function curry(fn) { 2 var args = Array.prototype.slice.call(arguments, 1); 3 return function() { 4 var innerArgs = Array.prototype.slice.call(arguments); 5 var finalArgs = args.concat(innerArgs); 6 return fn.apply(null, finalArgs); 7 }; 8 } 9 10 //使用方法 11 function add(num1, num2) { 12 return num1 + num2; 13 } 14 var curriedAdd = curry(add, 5); 15 console.log(curriedAdd(3)); 16 17 var curriedAdd = curry(add, 5, 12); 18 console.log(curriedAdd());