Home  >  Article  >  Web Front-end  >  What does nan mean in jquery?

What does nan mean in jquery?

WBOY
WBOYOriginal
2022-04-24 18:08:033085browse

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.

What does nan mean in jquery?

The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.

What does nan mean in jquery

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn