function add(x,y,z){
console.log('结果',x+y+z);
};
function curry(fn){
let args = [].slice.call(arguments,1);
let len = fn.length;
let newLen = args.length;
if(newLen == len){
return fn.apply(this,args);
}
if(newLen > len){
console.log('参数传递多了...');
}
function loop(){
args.push(...arguments);
newLen += arguments.length
i f(newLen == len){
return fn.apply(this,args);
}
if(newLen > len){
console.log('参数传多了...');
}
return loop;
}
return loop;
}
curry(add,2,1)(2);