4 ms·
I include this in sugar as in: You can refactor an arrow function into a specific regular function but you usually end up with something more verbose. Or in o
by dgb23 6y ago
I include this in sugar as in:
You can refactor an arrow function into a specific regular function but you usually end up with something more verbose.
Or in other words you can express all things "arrow" before it existed. Which is exactly what we did before they were adopted. And we still in fact do, just automated by transpilers like Babel[0].
But more importantly, in the context of the article: all functions in JS are closures, regardless of how you write them.
[0] https://babeljs.io/docs/en/babel-plugin-transform-arrow-functions https://babeljs.io/docs/en/babel-plugin-transform-arrow-func...
- esperent 6y ago> I include this in sugar as in: Fair enough, but you are probably alone in doing so.
- FranceBacce 6y agoWell you couldn't resolve "this" lexically without some closure tricks like that = this , so sure, you could do everything you do with arrows without them, but not with one function alone