Comment

scott christopher

I tend to use:

function isInt (i) {
return (i % 1) == 0;
}

Replies

Peter Bengtsson

This fails on floating point numbers. isInt("1.1") is false but isInt("1.0") is true which it's not supposed to.

Stuart Thiel

Thanks, used and credited.