Curry recipe in JavaScript
Curry is a very important yet very confusing concept in javascript. It enables the door of javascript programming towards functional programming. Curry allows a function with a series of arguments.
What is curry?
Currying allows us to produce a new function by combining a function and an arguments.
Example
We will take an example of volume vs area. Volume is a three-dimensional entity which is a multiplication of length, width, and height. However area is a two-dimensional entity which is the multiplication of on length and width. Below code snippet shows the simple approach to calculate volume. Noncurrying example:
Using currying in javascript we can implement a chain of returning function that will calculate the volume of the cube. Now one can ask the question of why we need such implementations.