+ 1

# Why typeof NaN is number?

4 ответов

+ 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.