Your Submissions
You haven't submitted any code for this challenge yet. Solve the problem by passing all the test cases, and your submissions will appear here.
xxxxxxxxxx
17
function curry(func) {
// ...args collects arguments as array
return function curriedFunc(args) {
// Check if current args passed equals the number of args func expects
if (args.length >= func.length) {
// if args length equals the expected number, pass into func (spread)
return func(args);
} else {
/* Else, we return a function that collects the next arguments passed and
recursively call curriedFunc */
return function (next) {
return curriedFunc(args, next);
};
}
};
}
OUTPUT
Results will appear here.