JavaScript (ES2026) reference · JSON and Global Functions
JavaScript isNaN() Function
Return true if a value is NaN after converting it to a number, so isNaN("hello") is true. Prefer Number.isNaN().
JavaScript (ES2026) Since ES1
Syntax
isNaN(value)
Parameters
| Parameter | Description |
|---|---|
value |
The value to test. |
Return value
true or false.
Examples
console.log(isNaN(NaN), isNaN("hello"), isNaN("42"), isNaN(""));
Output
true true false false
console.log(isNaN(undefined), Number.isNaN(undefined));
Output
true false
Version history
| Version | Change |
|---|---|
| JavaScript ES1 | Added |
Related
Number.isNaN()· Return true only if a value is the number NaN. Unlike the global isNaN(), it doesn't convert strings first.isFinite()· Return true if a value is a finite number after converting it to a number. Prefer Number.isFinite() for strict checks.- JavaScript Type Conversion · tutorial