DEV Community

Cover image for Currying in JavaScript

Currying in JavaScript

Anuradha Aggarwal on January 17, 2021

Hello developers!! In this part of the series, we will discuss techniques to work with function in Javascript called Currying. What is Cu...
 
hungluong profile image
Hung Luong

I understand, but variable naming was not my concern. The point is that most of the time this pattern is just used for the sake of currying itself i.e a => b => c => //imperative code with a, b and c anyway. In which case it's only easy to write, not read - a reader (like me) can be left with "yes but why??"

It's already arguable that we need both multiply and multiplyByTwo. Surely there are valid use cases out there, especially in term of function factories, I just don't see many of them in my experience.

Collapse
 
hungluong profile image
Hung Luong

Honestly speaking, I see the b => a => a * b pattern to be needlessly terse. Very rarely do I see that pattern (and sometimes, currying itself) serve any practical purpose other than trying to appear "functional". Just my 2c though, to each their own.

Collapse
 
davik4life profile image
Victor Adeshile

Awesome input.

Collapse
 
anuradha9712 profile image
Anuradha Aggarwal

Thank you!!

Collapse
 
darryl profile image
Darryl Young

Great article. Thanks for sharing.

Collapse
 
anuradha9712 profile image
Anuradha Aggarwal

I'm glad you find it useful

Collapse
 
imprimph profile image
Jaswanth

Feels like currying is a kind of crying

Collapse
 
theonejonahgold profile image
Jonah Meijers

What makes you feel that way? I’m an avid proponent of currying, so I’d like to hear the point of view from the other side as well