Feature Request: Number.isNumber()
adrian.sieber1 at gmail.com
Sun Apr 10 15:08:27 UTC 2016
checking if a value is a number is currently really complicated and
I have stumbled upon a fair amount of code where this lead to bugs.
The easiest way is `typeof value === 'number'`.
This however has the drawback that `NaN` also evaluates to true.
Furthermore, basically every expression preceded by a `+` evaluates to true.
… and there are even more gotchas. For a full roundup read
This implementation could also be used as a starting point.
(However, I would argue that `isNumber('3')` should evaluate to false.
It's a string after all.)
Therefore I think a `isNumber` functionality should already be provided
What do you think?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the es-discuss