What is the reasoning? I believe this is the only value not equal to itself in JavaScript.
Asked
Active
Viewed 426 times
2
-
2Note that `NaN == NaN` also returns false. – MD Sayem Ahmed Apr 02 '13 at 12:32
-
1Because the spec says so? Your believe is correct. – Bergi Apr 02 '13 at 12:35
-
1i've found this to be more helpful than the "Why is NaN not equal to NaN" question suggested by SO editors above: http://stackoverflow.com/questions/1565164/what-is-the-rationale-for-all-comparisons-returning-false-for-ieee754-nan-values ... in a nutshell, because NaN contains information about what something isn't (rather than what it is), NaN (e.g. sqrt(-2)) can never said to be definitely equal to NaN (e.g. sqrt(-3)) – po.studio Apr 02 '13 at 12:49
1 Answers
1

Community
- 1
- 1

teamalpha5441
- 741
- 1
- 6
- 20
-
2They question is asking *why*, not what alternatives there are to `!==` for this. – Quentin Apr 02 '13 at 12:35