O'Reilly logo
  • Ahmed Elgendy thinks this is interesting:

NaN never equals any other value, including itself, so to test for NaN use the function isNaN


Cover of Head First JavaScript Programming


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.