+ 1
why typeof NaN is a 'number' ?
console.log(typeof NaN); //number Why!! , NaN 'means Not a Number'.
1 ответ
+ 1
Well it's hard to explain but I will try:
NaN is result of some calculation, that negate mathematical logic. For example 1/0 (1 divided by 0). It cannot be represented mathematicly (is this a word?), but for computer it's still a number, perhaps too complex to express, so programmers had an idea to make it easier for computer by introducing NaN.
In shortcut: NaN is still a number, just too complex, or too big to express.