JavaScript(JS) number method - nan

‮i.www‬giftidea.com

The NaN property in JavaScript represents a value that is not a number. It is a property of the global NaN object and is a special value that indicates an unrepresentable or undefined value in the IEEE floating-point standard.

Here's an example usage:

console.log(NaN); // NaN
console.log(typeof NaN); // "number"
console.log(NaN === NaN); // false
console.log(isNaN(NaN)); // true

In the above example, NaN is used to represent a value that is not a number. The second call returns "number" because NaN is a special value of the number type. The third call returns false because NaN is not equal to any other value, including itself. The fourth call uses the isNaN() function to check if a value is NaN. It returns true because NaN is not a number and therefore satisfies the condition for being a NaN.