Why is NaN Considered a number While using the typeof Operator?? NaN=(Not A Number) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why is NaN Considered a number While using the typeof Operator?? NaN=(Not A Number)

26th May 2018, 3:47 PM
Feras Harb
Feras Harb - avatar
2 Answers
+ 6
NaN is simply the representation of an indefinite result. That means that complex numbers or things like 0 ÷ 0, ∞ * 0, etc. are represented as NaN. It is still a numeric data type, but it is undefined as a real number. In the same way it is used to represent anything that is not within the definition of what is number.
26th May 2018, 3:55 PM
Mickel
Mickel - avatar
+ 1
thank you
28th May 2018, 1:46 PM
Feras Harb
Feras Harb - avatar