Experts Exchange > Posts > Today I Learned: currying is possible in Javascript ES6 …
Today I Learned: currying is possible in Javascript ES6 (ES2015).
Javascript has always considered functions to be first-class citizens of the language, meaning we can pass them around as input for other functions. Currying allows us to create temporary stateful copies of other (stateless template) functions, which we then can apply to local variables.
As far as I can tell, currying was created both to accommodate languages that limit the amount of arguments (input passed into a function) to 1, and to allow functions to remember variable contents without having to write out a variable that remembers it, giving it the pretense of being stateless. (In functional programming, people harp on writing stateless code, but also love currying.)
You can try this out yourself over on SoloLearn, for instance, where I've saved a runnable version of above code sample. https://code.sololearn.com/WrcW2Gmsfn2q/
So this year I decided it was really about time I applied for the
@vExpert subprograms, and guess what! I'm in! So Thanks to our Programme Manager @vCommunityGuy and Sub Programme Business Units!