function isFloat(num) { return num.toFixed() != num; } alert( true === isFloat(3.9) === !isFloat(4) === !isFloat(4.0) === isFloat(4.000000001) );