Why does typeof NaN result in 'number'?


Why does typeof NaN result in ‘number’?


Because NaN(literally, Not a Number) is received when a number error message is given. This is demonstrated by running obvious math errors 0/0 or dividing a string by a number. But that number is still a number by definition. 0/0 may give NaN, but if that was a valid math function, it would result in a number.


// Run in a console window
0/0 // outputs NaN
"Hello, World!" / 3 // also outputs NaN, but if valid, the answer would be a number

Share your thoughts below