Javascript NaN

Introduction

Javascript NaN is a property of the global object.

The NaN is Not-A-Number, which is the same as the value of Number.NaN.

NaN compares unequal (via ==, !=, ===, and !==) to any other value, including to another NaN value.

Use Number.isNaN() or isNaN() to determine whether a value is NaN.

console.log(NaN === NaN);        // false
console.log(Number.NaN === NaN); // false
console.log(isNaN(NaN));         // true
console.log(isNaN(Number.NaN));  // true



PreviousNext

Related