what kind of problem is this fat arrow feature trying to solve ?

Claude Pache claude.pache at gmail.com
Wed Oct 2 01:37:53 PDT 2013


Le 2 oct. 2013 à 09:34, David Bruant <bruant.d at gmail.com> a écrit :

>> 
>> So I actually wonder what kind of JavaScript **you** write because this was a honest question but probably ... people not familiar with JS are the answer: since developers ignore part of JS specs available since every then we need a fat arrow to break old syntax to make the creation of self bound function easier.
> One of the reason of arrow functions to exist is to get rid of the need for "var self = this" or equivalent ('that', '_this', etc.). Example on MDN:
> https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/arrow_functions#Lexical_this

+1. The big win of arrow-functions, is that it prevents from using various ad-hoc kludges (`var that = this`, `[].some(..., this)`, etc), whose sole goal is to defeat some unwanted feature (proper `this` binding in callbacks). Not a killing-feature, but a nice addition that will help to reduce noise in code.

—Claude



More information about the es-discuss mailing list