DEV Community

Discussion on: Currying in JS 🤠

Collapse
 
fjones profile image
FJones • Edited

Another (arguably more important in practical use) aspect of currying is that enforcing a single argument to the final produced function allows for greater automation in the evaluation.

Consider nested function calls or array operations. While currying is less about minimizing side effects (nothing prevents the curried functions from being stateful - in fact one might argue that currying can encourage stateful functions), it is certainly more aligned with a functional paradigm to write, say arr.filter(isDivisibleByTwo) over arr.filter((v) => isDivisible(2, v)).