News for hackers. Stuff that matters.
Re:WTFJS? by kwamenum86 on Friday February 12, 2010 @09:15PM (#1122401)
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.
Re:WTFJS? by andreyf on Friday February 12, 2010 @09:25PM (#1122412)
Yes, 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.