Using this curry helper with a function that has a rest parameter, what does add(1)(2) return?
function curry(fn) {
return function c(...args) {
return args.length >= fn.length
? fn(...args)
: (...more) => c(...args, ...more);
};
}
const add = curry((a, b, ...rest) => a + b + rest.reduce((s, n) => s + n, 0));
console.log(add(1)(2));