+ 1

# Why typeof NaN is number?

4 Answers

+ 7

That has to do with how floating point numbers work.
I don't know if you know binary so I won't go into much detail, but basically a NaN is a floating point number like any other. It just does not represent a value.

+ 13

**Interesting facts about JavaScript numbers:
â˘ JavaScript implements a standard called "floating point math". Their decimal part offers more precision closer toÂ 0, and less precision further away from it. We can say the decimal point is "floating".
â˘ Numbers resulting from invalid math operations like 1/0 or 0/0 are special. NaNÂ is one of such special numbers.
â˘ typeof(NaN) is a number because it is a numeric value. Itâs called "Not a Number" because it represents the idea of an "invalid" number.

+ 4

Only the god knows đ

+ 2

NaN means unknown number.
It's without a value.
Like 0 but without a value.
So it's from number type.