+ 30
I am confused
Can someone explain me this code step by step... https://code.sololearn.com/WZG3pvtov4Vr/?ref=app
2 Respostas
+ 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
+ 24
Thank you very much.