"use strict" VS setTimeout

Mark Miller erights at gmail.com
Sun Sep 7 11:50:21 PDT 2014


On Sun, Sep 7, 2014 at 11:44 AM, Garrett Smith <dhtmlkitchen at gmail.com>
wrote:

> On 9/7/14, Domenic Denicola <domenic at domenicdenicola.com> wrote:
> > I don't understand why this is any more surprising than any other
> function
> > that calls its callback with .call(something). It doesn't matter whether
> the
> > callback is strict or not; .call(window), which is what the spec does,
> will
> > override it.
> >
> > As far as I can see this issue has absolutely nothing to do with strict
> vs.
> > sloppy.
> >
> I agree on that point; setTimeout passes the window to the callback as
> the this value. But that has nothing to do with inheritance.
>

Who said anything about inheritance?



>
> Method setTimeout uses the global object as the `this` value for the
> callback function, much like addEventListener, etc, as does
> `.call(window)` like you mentioned.
>

Yes it does. The question is: should it?


-- 
  Cheers,
  --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140907/547f19d8/attachment.html>


More information about the es-discuss mailing list