Input value | getType() returns |
is<Type>() function(s) |
---|---|---|
42n |
BigInt |
isBigInt() |
42 |
Number |
isNumber() |
3.14 |
Number |
isNumber() |
Infinity |
Number |
isNumber() |
-Infinity |
Number |
isNumber() |
NaN |
Number |
isNumber() * |
* Technically NaN
is a number, so getType()
will yield Number
and isNumber()
will return true
for consistency. You would probably be better off using JavaScript's native isNaN()
or Number.isNaN()
if that's a concern.