I actually listened to a fresh interview with Brendan Eich yesterday, where he said that the keyword function he chose when he was prototyping JavaScript turned out to be a bit on the longish side for the JavaScript parser, which negatively affected its speed; so when the video mentioned the shortcut for the function keyword, it sounded a little too real.
Well you can't really reuse arrow functions unless you put it into an object. Also it always binds this...there are some scenarios where this arguably isn't wanted
Edit: and anyways if you don't want to bind this, don't use an arrow function
I can see many cases for that. Say you work in an instance of an object and would want to use multiple functions inside your class for your code, it doesn't work with arrow functions properly (or you set the this variable to something else). And i would separate those functions to make my functions lean and clean.
That would mean that if i would use arrow functions for other items, it gets mixed and makes it into more spaghetti than i would normally have when i'm not using them.
I can understand using them to minify your code but for reading and working with it, it doesn't hold any benefit whatsoever.
25
u/azangru Apr 01 '17
I actually listened to a fresh interview with Brendan Eich yesterday, where he said that the keyword
functionhe chose when he was prototyping JavaScript turned out to be a bit on the longish side for the JavaScript parser, which negatively affected its speed; so when the video mentioned the shortcut for thefunctionkeyword, it sounded a little too real.