NaN === false => false, isn't NaN falsy?NaN === NaN => false, but !!NaN === !!NaN => trueI've been racking my brain trying to figure this out.
Although either side of NaN===NaN contains the same value and their type is Number but they are not same. According to ECMA-262, either side of == or === contains NaN then it will result false value.
NaN is not equal to NaN! Short Story: According to IEEE 754 specifications any operation performed on NaN values should yield a false value or should raise an error. Thanks CJ J for sharing this.
isnan() isNaN() method returns true if a value is Not-a-Number.
false are very different things, that's why one has a y instead of an e. ;)NaN is spec'd to never be equal to anything. The second part of your question is comparing false === false, which is funnily enough, true :)If you really want to know if something is NaN, you can use Object.is(). Running Object.is(NaN, NaN) returns true.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With