What is fn.length in the curry function?
fn.length is the number of parameters declared in the original function. The curry function uses it to know when enough arguments have been collected to call the original function.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in Currying Implementation and Examples
Use nested functions: function multiply(a) { return function(b) { return function(c) { return a * b * c; }; }; }. Each function takes one argument and returns the next.
Return a function that collects arguments. If args.length >= fn.length, call fn(...args). Otherwise, return (...next) => curried(...args, ...next). Use recursion to keep collecting.
Configurable functions: const log = curry((level, msg) => ...); const error = log('ERROR'); error('something broke'). Each partial call creates a specialized function.
Still have questions?
Browse all our FAQs or reach out to our support team
