3 ms·
Arrow functions and `let` are what is generally considered to be the "correct" way of doing things. They behave more closely to how other languages behave, and
by rcfox 11y ago
Arrow functions and `let` are what is generally considered to be the "correct" way of doing things. They behave more closely to how other languages behave, and should reduce overall confusion in the long term.
The arrow operator is indeed syntactic sugar for binding `this` to the function. It's not really necessary, but it makes it much easier to do what you expect to do 99% of the time.
Yes, it sucks that there are now two slightly different ways of doing things, but it's better than breaking all of the existing code currently in use. Hopefully, linters and analysis tools will mark `var` and non-arrow functions as deprecated soon after the major engines support ES6.