@@toStringTag spoofing for null and undefined

Claude Pache claude.pache at gmail.com
Mon Feb 9 07:43:23 PST 2015


> Le 9 févr. 2015 à 16:15, Gary Guo <nbdd0121 at hotmail.com> a écrit :
> 
> I propose addition of String.prototype[@@toStringTag] as well as abridgement of Object.prototype.toString.

The issue with that approach, is that `O.p.toString.call(String.prototype)` will return "[object String]", but, for ES6, `String.prototype` is not a String object, leading to a false positive that could break legacy code. (Don't know whether it is a problem in practice.)

—Claude
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150209/c9cf79e9/attachment.html>


More information about the es-discuss mailing list