The concepts of Closures, Partials, and Currying are similar. They are not exclusive to JavaScript. I will outline the three ideas in this article.
Closures are functions that remember the environment in which they have been created.
In the above example, we define sumWith10
by another function. We preset a parameter, and what we get is another function (that is returned by sum). The newly created sumWith10
remembers its context.
The above function can also be called with double brackets; you might have already seen this syntax.
#es6 #learn-javascript #javasscript