1function hasDecimal (num) {
2 return !!(num % 1);
3}
4hasDecimal(2) // true
5hasDecimal(2.345) // false
1The Number. isInteger() method determines whether a
2value an integer.
3This method returns true if the value is of the type
4Number, and an integer (a number without decimals).
5Otherwise it returns false.