Earlier quoted context omitted.
"1) Isn't it just (!isNaN(num) && isFinite(num))? I know that's pretty far from intuitive, but it's not as bad as you made it sound. That being said, i'd love an `isNumber` function at some point..." You just proved my point! A) Even if you are correct - it's terrible . This is completely ridiculous that there's no basic check for extremely common and mundane type-checking. Moreover, it's the same issue for other typ…
FFS read the code before spouting random stuff. (!isNaN('100') && isFinite('100')) Negation (!) before isNaN()
(!isNaN('100') && isFinite('100')) === true
My check would treat '100' as a number, so if i did something like this it would break unexpectedly:
var num = '100'
if ((!isNaN(num) && isFinite(num)) === true) {
console.log(num + 10)
}
You'll get "10010" printed to the console.