bhylu.com

Advertisements

JS NaN

NaN is a Number value representing an invalid numeric result. It is not equal to itself.

Where to run this

This example uses the JavaScript console playground. Select Run to execute it; the example does not run on this lesson page.

A practical example

JavaScript

const quantity = Number("several");
console.log(Number.isNaN(quantity));
console.log(quantity === NaN);

What happens

The checks produce true and false.