CHALLENGE
function curry(fn) {
return function curried(...args) {
if (args.length >= fn.length) {
return fn.apply(this, args);
}
return function(...moreArgs) {
return curried.apply(this, [...args, ...moreArgs]);
};
};
}
const multiply = curry((a, b, c) => a * b * c);
const double = multiply(2);
const result = double(3)(4);
console.log(result);
>>Click here to continue<<