Check if a number has a decimal place/is a whole number
Using modulus will work: num % 1 != 0 // 23 % 1 = 0 // 23.5 % 1 = 0.5 Note that this is based on the numerical value of the number, regardless of format. It treats numerical strings containing whole numbers with a fixed decimal point the same as integers: ‘10.0’ % 1; … Read more