function add() {
let _args = Array.prototype.slice.call(arguments);
let _adder = function () {
_args.push(...arguments);
return _adder;
};
_adder.toString = function () {
return [].reduce.call(_args, (a, b) => a + b, 0)
}
return _adder
}
console.log(add(1)(3)(3, 4))
const persons = [
{ name: 'kevin', age: 4 },
];
function curry(fn, currArgs) {
return function () {
let args = [].slice.call(arguments);
if (currArgs !== undefined) {
args = args.concat(currArgs);
}
console.count(1)
if (args.length < fn.length) {
return curry(fn, args);
}
return fn.apply(null, args);
}
}
console