⬅︎ Back to isInt() JavaScript function
I tend to use:function isInt (i) { return (i % 1) == 0;}
This fails on floating point numbers. isInt("1.1") is false but isInt("1.0") is true which it's not supposed to.
Thanks, used and credited.
Comment
I tend to use:
function isInt (i) {
return (i % 1) == 0;
}
Replies
This fails on floating point numbers. isInt("1.1") is false but isInt("1.0") is true which it's not supposed to.
Thanks, used and credited.