In jquery, nan is the abbreviation of "Not a Number", which represents special values of non-numeric values, undefined or unrepresentable values; nan itself is of type number, used to indicate that the specified value is not a number. You can use the isNaN() method to determine whether a value is a number.
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
The NaN attribute is a special value that represents a non-numeric value. This attribute is used to indicate that a value is not a number. A Number object can be set to this value to indicate that it is not a numeric value.
isNaN() global function to determine whether a value is a NaN value
Number.NaN is a special value indicating that the result of certain arithmetic operations (such as finding the square root of a negative number) is not a number. The methods parseInt() and parseFloat() return this value when the specified string cannot be parsed. For some functions that normally return valid numbers, you can also use this method and use Number.NaN to indicate its error conditions.
JavaScript outputs Number.NaN as NaN. Note that NaN is always unequal when compared to other numbers, including itself. Therefore, you cannot compare with Number.NaN to test whether a value is a number, but can only call isNaN() for comparison.
is the abbreviation of not an number.
NaN means it is not a number, but it is of type number.
NaN and NaN are not equal
Extension
You can use isNaN to determine whether the
var num=3; window.isNaN(num);
result is false.
isNaN() This method can determine whether a number is a number.
Recommended related video tutorials: jQuery video tutorial
The above is the detailed content of What does nan mean in jquery?. For more information, please follow other related articles on the PHP Chinese website!