function addFun(...arr) {
return arr.reduce((pre, cur) => pre + cur, 0);
}
function sum(...args) {
let temp = (...args2) => {
return sum(addFun(...args, ...args2));
};
temp.add = () => {
return addFun(...args);
};
return temp;
}
console.log(sum(1)(2, 3)(4, 5, 6).add());
柯里化函数
最新推荐文章于 2024-09-02 17:34:07 发布