I looked at this answer and was not satisfied:
How to check if a JavaScript number is a real, valid number?
I thought it would be faster and more concise to do:
Pub.isRealNum = function (check) {
return ( check === +check ) && (check !== Infinity) && (check !== -Infinity);
};
Are there any cases I'm missing?
It works for
1 ( true )
1.1 ( true )
0 ( true )
Infinity ( false )
NaN ( false )
"foo" ( false )
function(){} ( false )
Does underscore have an equivalent?
I looked briefly here at the API but did not see any thing: