3 ms·
NaN is the ultimate horror within JavaScript's type system. Other than that, you're spot-on.
by azeirah 9y ago
NaN is the ultimate horror within JavaScript's type system.
Other than that, you're spot-on.
- merb 9y agoor undefined and null. I mean most languages have "problems" with null, but JS basically has two "problems".
- gsnedders 9y agoNaN behaves as it does in any other language with IEEE 754 floats (the behaviour of NaN simply comes from IEEE 754), which is most…?
- dragonwriter 9y ago> NaN behaves as it does in any other language with IEEE 754 floats Yes, but most other languages don't use IEEE 754 binsry floating point as their only numeric type. Or even their primary one.
- cpburns2009 9y agoWhile I dislike NaN and would much rather prefer an exception to be thrown, I can accept NaNs existence because it's at least part of the IEEE 754 standard. It still bugs me that `NaN != NaN`, and JavaScript's type coersions make NaN worse because it seems like they randomly popup.
- ng12 9y agoHow many times have NaN semantics actually broken your code? My guess is never.