2

What is the reasoning? I believe this is the only value not equal to itself in JavaScript.

keypulsations
  • 3,659
  • 5
  • 23
  • 36
  • 2
    Note that `NaN == NaN` also returns false. – MD Sayem Ahmed Apr 02 '13 at 12:32
  • 1
    Because the spec says so? Your believe is correct. – Bergi Apr 02 '13 at 12:35
  • 1
    i'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)) – keypulsations Apr 02 '13 at 12:49

1 Answers1

1

NaN isn't equal to NaN

Use the IsNaN function to check it

See here

Community
  • 1
  • 1
teamalpha5441
  • 691
  • 1
  • 6
  • 19