how to make sure a value has a decimal value js code example
Example: how to know if a number has a decimal number js
function hasDecimal (num) {
return !!(num % 1);
}
hasDecimal(2) // true
hasDecimal(2.345) // false
function hasDecimal (num) {
return !!(num % 1);
}
hasDecimal(2) // true
hasDecimal(2.345) // false