Why Number(symbol) crashes?
krissiegel at gmail.com
Tue Oct 11 15:59:57 UTC 2016
Symbol is such an oddball; similar to this if you do Symbol() + "" it will
also throw an exception unlike all other built-ins. Granted I have no idea
what a string representation of Symbol *really* would be but no other built
in type behaves the way Symbol does.
I do think Number(Symbol()) should return NaN though. I'd like to know why
this didn't happen.
On Tue, Oct 11, 2016 at 2:07 AM, medikoo <medikoo+mozilla.org at medikoo.com>
> I was searching the archived but wasn't able to find the answer.
> What's the reasoning behind having Number(symbol) crash instead of
> NaN (as it's in case all other non-coercible values?). It feels not
> If someone can point me to some discussion that provided the reasoning I'd
> be grateful
> View this message in context: http://mozilla.6506.n7.nabble.
> Sent from the Mozilla - ECMAScript 4 discussion mailing list archive at
> es-discuss mailing list
> es-discuss at mozilla.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss