javascript comment dire si un nombre est un nombre entier?
Using modulus will work:
num % 1 != 0
// 23 % 1 = 0
// 23.5 % 1 = 0.5
Delightful Dormouse
Using modulus will work:
num % 1 != 0
// 23 % 1 = 0
// 23.5 % 1 = 0.5
// how to check if a number is a whole number in javascript
console.log(Number.isInteger(123)); // true
console.log(Number.isInteger(123.123)); // false