arrow function syntax simplified
waldron.rick at gmail.com
Fri Mar 30 05:31:45 PDT 2012
On Friday, March 30, 2012 at 6:03 AM, Marius Gundersen wrote:
> > Indeed lexical |this| means you can't pass a wrong-this even via .call or .apply. Thanks,
> Isn't this a bad idea? Take for example the very common jQuery callback method, which would look like this:
> $("img").on("click", e => $(this).hide());
> jQuery (and many other frameworks) do a lot of things with |this| behind the scenes, where it would be very nice to have |this| be set by the framework.
jQuery provides the same |this| value that you'd get using addEventListener, so this issue would exist in the DOM as well.
More pointedly, lexical |this| prevents modifying |this| via apply and call
I had hoped for thin arrow to lighten the keystroke load here.
> Or is the consensus that the current way of doing this is not good, and should be discurraged?
> Marius Gundersen
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss