Just out of curiosity.
It doesn\'t seem very logical that typeof NaN
is number. Just like NaN === NaN
or NaN == NaN
returning
Javascript has only one numeric data type, which is the standard 64-bit double-precision float. Everything is a double. NaN is a special value of double, but it's a double nonetheless.
All that parseInt
does is to "cast" your string into a numeric data type, so the result is always "number"; only if the original string wasn't parseable, its value will be NaN.