"use strict" VS setTimeout
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>
> On 9/7/14, Domenic Denicola <domenic at domenicdenicola.com> wrote:
> > I don't understand why this is any more surprising than any other
> > that calls its callback with .call(something). It doesn't matter whether
> > callback is strict or not; .call(window), which is what the spec does,
> > override it.
> > As far as I can see this issue has absolutely nothing to do with strict
> > 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?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss