I don't see the beauty of ES6 arrow functions
Hello guys i don't know if it's really awkward but the arrow function feel so intimidating and strange to me , i've been trying to understand it for over a week or so , can anyone explane it more clearly ?
11/26/2018 12:13:35 PMOmar khaled
9 AnswersNew Answer
Omar khaled Have a nice Coding!;)👍😄🤓 https://www.sololearn.com/post/48576/?ref=app https://code.sololearn.com/WGNbcu840MY1/?ref=app
Omar khaled Here an example, to love arrow functions! 😀👍😉 https://code.sololearn.com/WxEg6de0NtKy/?ref=app
Declaring a function in a variable has advantages, and it is called a function expression (opposed to a function declaration). This type of function doesnt get invoked when the code is read and only when it is called, and it is very useful when using first class functions (passing a function as a parameter to another function), as well as other advantages.
I saw a presentation once where the speaker said arrow functions were originally used to make presentations more clear. It was deadpanned (so, no idea if it was a joke; I don't remember if anyone laughed) but it felt like the tone was "because it's less clutter". I think I can find the presentation again (it was a really interesting list of JS feature quirks...though now...I think it might contain a significant amount of adult language), but anyway..just earmarking this Q&A so I have a bookmark for possible update.
Calvin, why would we define the function for a certain variable what difference does it make , than defining the function in isolation from variables , thanks