JS Sprawdź, czy numer ma dziesiętne
num % 1 != 0
Aci
num % 1 != 0
function hasDecimal (num) {
return !!(num % 1);
}
hasDecimal(2) // true
hasDecimal(2.345) // false
The Number. isInteger() method determines whether a
value an integer.
This method returns true if the value is of the type
Number, and an integer (a number without decimals).
Otherwise it returns false.