Would currying work without closures in JavaScript?
No. Currying requires each returned function to remember the previous arguments. This is only possible with closures. Without closures, the inner function would not have access to outer arguments.
Verify This Answer
Cross-check this information using these trusted sources:
More FAQs in How Currying Relies on Closures in JavaScript
Each curried function returns a new function that closes over the previous arguments. The inner function has access to all outer arguments via the closure. Without closures, currying would not work.
Closures provide the accumulated arguments (state) across calls. Each returned function remembers the previous arguments via the closure. Without closures, the inner function would not have access to outer arguments.
The returned arrow function (...next) => curried(...args, ...next) closes over args and fn. Each partial call accumulates arguments via the closure. When enough are collected, fn is called.
Still have questions?
Browse all our FAQs or reach out to our support team
