Claude Pache claude.pache at
Tue Aug 12 14:17:24 PDT 2014

Le 12 août 2014 à 22:35, Erik Arvidsson <erik.arvidsson at> a écrit :

> Right now String(symbol) throws because it uses ToString which is spec'ed to throw.
> I'm suggesting that we special case String(value) to do a type check for Symbol and return the same string as does.
> The motivation for this is that String(value) is pretty explicit and was in ES5 a safer way to stringify something than value.toString().
> -- 
> erik

+1. As I already noted last year [1], as currently specced, ad-hoc debugging code like `alert("got argument: " + x)` or `alert("got argument: " + String(x))` will throw for symbols, while `alert("got argument: " + x.toString())` will throw for `null`, `undefined`, and `Object.create(null)`.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list