How does this code looks in a simple way? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How does this code looks in a simple way?

const add = a => b => a + b;

5th Apr 2022, 7:16 AM
🕸carpe diem🕸
🕸carpe diem🕸 - avatar
3 Answers
+ 5
It is simply a function called currying in js const add = (a, b) => a + b
5th Apr 2022, 8:07 AM
Shahghasi Adil
Shahghasi Adil - avatar
+ 2
Your add function is returning a function https://code.sololearn.com/ckPsb2cKIZ8F/?ref=app To use it, you'll need to pass the parameters separately with two separate pairs of parenthesis.
6th Apr 2022, 2:45 AM
Gordon
Gordon - avatar
0
Thanks a lot
5th Apr 2022, 10:19 AM
🕸carpe diem🕸
🕸carpe diem🕸 - avatar