Le 10 juil. 2013 à 11:26, David Bruant <[email protected]> a écrit :
> Hi, > > I was wondering whether it was any useful to have the thisArg argument in > Array#find and Array#findIndex. > As of ES6, the language has Function.prototype.bind and arrow functions and I > would imagine these to be enough to cover any use case where thisArg would be > used. > > I know that in the majority of cases I have experienced, there is no need for > a specific 'this' at all. In the majority of the remaining cases arrow > functions would have been enough. I guess .bind can do the job find for the > remaining 0.1% after that... > > David > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss * Consistency with every other Array methods that takes a predicate as first argument, and thisArg as second argument (map, filter, every, etc.). * You can use Array#find (and Array#filter, Array#every, ...) now (with a polyfill), but you have to wait, say, six years until you can use arrow functions on the web (until non-ES6 browsers are dead). Meanwhile, using "this" as second argument is the most concise and most elegant way to simulate arrow functions. —Claude _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

