> var obj={}.valueOf.call(obj);  // ToObject in case primitive value passed

Can you explain how this works?

- Why {} and not Object.prototype?

- I know valueOf as a method that returns a primitive if an object can be 
converted to one and |this|, otherwise. Oddly enough, this works both in strict 
mode and in non-strict mode, as explained in the comment.

Thanks!

Axel

-- 
Dr. Axel Rauschmayer

[email protected]
twitter.com/rauschma

home: rauschma.de
blog: 2ality.com



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to