NaN is a special value meaning "Not a Number". You get it when math operations fail:
console.log("hello" * 2) // NaN
console.log(Math.sqrt(-1)) // NaN
console.log(0 / 0) // NaN
Strangely, NaN has type "number". Even stranger, NaN doesn't equal itself:
console.log(NaN === NaN) // false
This means you can't use === to check for NaN. Use Number.isNaN() instead.