DEV Community

Discussion on: Introduction to Currying in JavaScript

tobisgd profile image

That's nice to know, but sadly doesn't answer the question. Why would I do that to my JS code? What are the advantages and do they outweigh the disadvantages of introducing all these context switches?

Thread Thread
fischgeek profile image

Curious, why are you so concerned with "context switches"? A function should only have knowledge of what it has been given.

Being able to pipe functions together is where the power (and fun) comes in! Have a look at F# For Fun and Profit for a reference on thinking functionally.

Also, see what they say specifically about currying.

I know these are referring to a different language, but the baisc principals remain. Hope this helps you! I'll try to come up with some "real-world" examples time permitting. Cheers.