Sunday, 15 September 2013

good enough 'is integer' check, javascript?

good enough 'is integer' check, javascript?

Is this good enough 'is-integer' check:
function isint( o ) {
return Number( o ) === parseInt( o );
}
I wanna get true for, say 12, 13, '14', '-1', and false for floats, and
anything else.

No comments:

Post a Comment