On Apr 12, 2011, at 12:57 AM, Lasse Reichstein wrote:
>
> In that case, why not just
> obj = Object(obj);
>
> It has the added advantage of not returning the global object for null and
> undefined,
> but just a plain new object (although either can be said to be wrong in this
> case).
I used {}.valueOf in order to avoid converting null and undefined to a new
object which would then be used as the starting point of the lookup.
In ES5
{}.valueOf.call(undefined)
doesn't yield the this object. In general, ES5 built-ins do not convert their
this parameter to the global object when it is undefined.
Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss