[рд╣рд▓] рдХреНрдпрд╛ рдЖрдк рдХреГрдкрдпрд╛ JavaScript рдореЗрдВ рд▓реИрдореНрдмреНрдбрд╛ function рдХрд╛ рдЙрджрд╛рд╣рд░рдг рджреЗ рд╕рдХрддреЗ рд╣реИрдВ?

  

3
рд╡рд┐рд╖рдп рдкреНрд░рд╛рд░рдВрднрдХрд░реНрддрд╛

I am still strugling to understand the lambda functions in JavaScript (() =>). Can you please give an example (or some examples) of lambda function used in JavaScript?

1 рдЙрддреНрддрд░
2

This video explains nicely:

and his code (on the 2nd line is the lambda function):

let x = function(a,b,c){return a+b+c;};
let x = (a,b,c) => a+b+c;
alert(x(2,5,1));

and:

setTimeout(function () {alert("2 seconds passed")}, 2000);
setTimeout(() => alert("2.3 seconds passed"), 2000);

you clearly see by comparison with the regular anonymous function and the lambda one that the last one is more convenient and less code is required ЁЯЩВ

рд╢реЗрдпрд░ рдХрд░рдирд╛: