Glossary Term
isNaN()
The isNaN() function determines whether a value is NaN, first converting the value to a number if necessary. Because coercion inside the isNaN() function can be surprising, you may prefer to use Number.isNaN().
isNaN() is a function property of the global object.
For number values, isNaN() tests if the number is the value NaN. When the argument to the isNaN() function is not of type Number, the value is first coerced to a number, and the resulting value is then compared against NaN.
This behavior of isNaN() for non-numeric arguments can be confusing! For example, an empty string is coerced to 0, while a boolean is coerced to 0 or 1; both values are intuitively “not numbers”, but they don’t evaluate to NaN, so isNaN() returns false. Therefore, isNaN() answers neither the question “is the input the floating point NaN value” nor the question “is the input not a number”.
Syntax example: isNaN(value)
Term Connections
Explore related terms connected by shared tags, shared categories, and relationship phrases. This map loads only when it comes into view.
Loading term connections…
