Number.isNaN

isNaN – Evaluates an argument to determine if it is not a number.

Description

Number.isNaN(mixed variable)

Parameters

Name Description Type Default Optional
variable mixed No

Return values

Returns true if the value is not a number, otherwise false.

Changelog

Version Description
ES 6 Introduced.

Examples

Example #1 – isNaN example
console.log(Number.isNaN(NaN)); // true console.log(Number.isNaN("string")); // false console.log(Number.isNaN("12")); // false console.log(Number.isNaN(12)); // false console.log(Number.isNaN(12.42)); // false console.log(Number.isNaN("")); // false console.log(Number.isNaN("\n\t")); // false console.log(Number.isNaN(null)); // false console.log(Number.isNaN(true)); // false console.log(Number.isNaN(undefined)); // false console.log(Number.isNaN(Infinity)); // false

External references