What logic is behind NaN evaluation?
javascript, logical-operators, nan
Solution
Because that's what the spec says.
Specifically, the IEE floating point spec says that `NaN` does not equal itself. Therefore, in Javascript, there is no value that `NaN` can ever equal.
`!NaN` is `true`, because `NaN` is a falsy value.
This makes all of your examples obvious.
Problem
Can you explain the logical evaluation of `NaN` in javascript? ``` NaN==NaN (false) !NaN==!NaN (true) NaN!=NaN (true) NaN==false (false) NaN==true (false) ``` I am a little surprised here...