2 ms·
When you run reverse with a context of anything besides an array you end up getting back that context. This is why assigning [].reverse to x, then running x()
by kwamenum86 17y ago
When you run reverse with a context of anything besides an array you end up getting back that context. This is why assigning [].reverse to x, then running x() returns window. It is an interesting quirk. Not sure if this is the js specified behavior though.
- andreyf 17y agoYes, this is JS specified behavior. If there is no activation object (one referenced by an identifier before the `.'), the value of `this' is set to the global object.