JavaScript Bagaimana mengatakan jika nomor adalah nomor utuh?
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