I am confused | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 30

I am confused

Can someone explain me this code step by step... https://code.sololearn.com/WZG3pvtov4Vr/?ref=app

31st Jan 2018, 8:44 PM
Robert
Robert - avatar
2 Answers
+ 9
The first line defines an anonymous function within an anonymous function. const add = a => b => a + b; // is the same as const add = function (a) { return function (b) { return a + b; } } The functions are defined using the ES6 arrow syntax, which works like this: (param OR paramList) "=>" (expression OR methodBody) Examples: const a = () => console.log('Hello'); a(); // prints hello const b = c => c * 2; b(4); // 8
31st Jan 2018, 8:51 PM
SplittyDev
SplittyDev - avatar
+ 24
Thank you very much.
1st Feb 2018, 10:35 AM
Robert
Robert - avatar