check to see if number has no decimal javascript code example
Example 1: js check if number has decimals
num % 1 != 0
Example 2: how to know if a number has a decimal number js
function hasDecimal (num) {
return !!(num % 1);
}
hasDecimal(2) // true
hasDecimal(2.345) // false