NaN is a special value in JavaScript’s number system

The name NaN means “Not a Number,” but it does not mean JavaScript has created a value outside its numeric system. It is a special numeric value used when a calculation produces a result that cannot be represented as an ordinary number—for example, dividing zero by zero.

JavaScript’s `number` type follows a floating-point format that reserves special values for cases such as positive infinity and NaN. So `typeof NaN` returns `"number"`: it reports the value’s type, not whether the value is a sensible, finite quantity.

NaN behaves unlike ordinary numbers

NaN can travel through calculations: arithmetic involving it generally produces NaN again, signaling that the result remains unusable as an ordinary number. It also has an unusual comparison rule: NaN is not equal to itself. That means `value === NaN` cannot detect it; JavaScript provides `Number.isNaN(value)` for that check.

The distinction matters when handling input or calculations. A value can pass a broad type check as a number and still be NaN, so code that needs a usable numeric result may need to check for NaN separately. In other words, JavaScript’s label tells you what kind of value you have—not whether that value can answer the question your program is asking.