NaN never equals any other value, including itself, so to test for NaN use the function isNaN
- 7. Types, Equality, Conversion and All That Jazz: Serious types
- Publisher: O'Reilly Media, Inc.
- Released: March 2014
Even though the following expression; "7" is really a NaN, after conversion, it is not considered NaN. So, for example, if you have to validate a phone number on a form and you are using isNaN to make sure that the user's entry was not a NaN, the user could enter the following: 323-"13" and it would pass the logical test as a valid phone number because after spliting, "13" is considered number and not NaN.