In my opinion it's a bit incoherent that each object-coercible type behaves differently when coercing symbols to it.
Symbols can be explicitly coerced to strings, but not implicitly: ```js String(Symbol("abc")); // "Symbol(abc)" Symbol("abc") + ""; // TypeError ``` Symbols can't be coerced to numbers, neither explicitly nor implicitly: ```js Number(Symbol("abc")); // TypeError +Symbol("abc"); // TypeError ``` Symbols can be coerced to booleans, both explicitly and implicitly: ```js Boolean(Symbol("abc")); // true !!Symbol("abc"); // true ``` Maybe the `Number` constructor could behave analogous to `String` and return `NaN` for symbols, instead of calling ToNumber.
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss