> Le 10 févr. 2015 à 06:40, Gary Guo <[email protected]> a écrit :
>
> Sorry for not noticing the change. It seems the ES6 spec changes the behavior
> of *.prototype object. In ES5, *.prototype is itself a * object. However,
> because in ES5 Object.prototype.toString.call(String.prototype) will return
> [object String], my proposal does not break any legacy code, instead, if not
> implemented, legacy code could be broken.
Changing `String.prototype` from String to non-String is indeed a risk by
itself. But the issue I was mentioning is independent of that, namely that an
unknown object would be misidentified as String and would throw on methods that
work only on Strings, e.g.: `if (getType(obj) == "String") { return
obj.toUpperCase() }`, where `getType()` is based on `O.p.toString`.
—Claude_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss