Why typeof NaN is number? | Sololearn: Learn to code for FREE!
+ 1

# Why typeof NaN is number?

1st May 2019, 2:42 PM
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.
1st May 2019, 3:03 PM
Schindlabua
+ 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.
26th Feb 2020, 2:58 PM
Danijel Ivanović
+ 4
Only the god knows 😂
1st May 2019, 2:53 PM
Seniru
+ 2
NaN means unknown number. It's without a value. Like 0 but without a value. So it's from number type.
1st May 2019, 5:42 PM
Basel.Al_hajeri?.MBH()
Актуальное сегодня
HELP ME