|
|
|
|
|
by cypher543
4367 days ago
|
|
It's consistent with the names of other type-checking functions. isNumber checks if a value is an instance of the Number class just like isDate checks if a value is an instance of the Date class. If it were isNumericType, they'd get questions about why the function doesn't follow the existing naming convention. The only reason this is confusing for people is because they aren't familiar with IEEE 754 floating-point numbers and their representations. But since floats are used in almost every programming language, it's something that any programmer should be familiar with. Once they learn exactly what NaN means in that context, then the confusion should disappear. |
|
NaN is part of IEEE 754, but it is not a number.
The reason people are confused is because the JS datatype name has a small but critical disconnect from what the values it contains are.