I\'m hoping there\'s something in the same conceptual space as the old VB6 IsNumeric()
function?
You could make use of types, like with the flow library, to get static, compile time checking. Of course not terribly useful for user input.
// @flow
function acceptsNumber(value: number) {
// ...
}
acceptsNumber(42); // Works!
acceptsNumber(3.14); // Works!
acceptsNumber(NaN); // Works!
acceptsNumber(Infinity); // Works!
acceptsNumber("foo"); // Error!