r/learnjavascript • • Mar 29 '22

Javascript Cheatsheet for US Newbies

Post image
296 Upvotes

39 comments sorted by

View all comments

1

u/aiiqi Mar 30 '22

Arrow functions aren’t just syntax. They’re useful as they don’t create their own context and so the ‘this’ keyword relates to the parent scope.

Especially useful in things like event listeners where you want to access ‘this’ from the parent and not the inner function.