Nan is not a number
The IsNaN () function attempts to convert the value to a numeric value after it has been received.
1 alert (IsNaN (NaN)); // true 2 alert (IsNaN); // false, 25 is a numeric value 3 alert (IsNaN (')) //false, ' 25 ' can be converted to a value of 4 alert (IsNaN (' Lee ')) //true, ' Lee ' cannot convert to value 5 alert (IsNaN (true)) // false, true can be converted to 1
The IsNaN () function can also be applied to an object. During the call to the IsNaN () function, the valueof () method is called first, and then the return value is determined to be converted to a number. If not, then test the return value based on this return value in the call to the ToString () method.
var box={ toString:function() { return ' 123 '; // can be changed to return ' Lee ' to see the effect; }};alert (IsNaN (box)); // false
How to use isNaN and its introduction