A simpler way to do curry functions in Javascript.
We have previously seen currying in Javascript. A simple form and application of that concept is demonstrated below -
|
|
Or, we could avoid a external function or library and curry using bindings ..
|
|
But, there is a simpler way to get the same result.
We just use arrow functions to collect arguments at different times.
|
|
We can make it more readable with a different notation to do the actual curry -
|
|
Of course, you have to rely back on the previously provided example if you don’t have all arguments in one go.