r/learnjavascript • u/ddmanton7220 • May 09 '20
Javascript Tutorial - Arrow Functions
https://www.youtube.com/watch?v=aYcH26h_HlI&t=26s12
u/Content_Performer May 09 '20
TL:DR functions but 'this' actually works
3
u/gotta-lot May 10 '20
I really don’t like when it’s described this way. In JavaScript, ‘this’ has a clear set of rules. It just behaves differently with arrow functions. They serve a very different purpose. Given the way we write JavaScript in 2020, maybe we favor the way it behaves with arrow functions, but I still think it’s unfair to say ‘this’ in function expressions and declarations is something that is broken.
1
u/43northwebdesign May 09 '20
What ide is this
2
1
u/bajcmartinez May 22 '20
great video, I've written an article with the don'ts of arrow functions, for those interested:
https://medium.com/@bajcmartinez/when-not-to-use-javascript-arrow-functions-a7340630d4a8
or in my personal site for those who don't have medium accounts:
https://livecodestream.dev/post/2020-05-22-when-not-to-use-javascript-arrow-functions/
9
u/[deleted] May 09 '20
For some reason I initially struggled to grasp arrow functions. Something about
.filter(function(item) {was easier to understand for me at the time.As with anything repetition is key. Write it enough, and you'll get it.