Use the Math.floor method to check whether a number has a decimal place or not.
Example
You can try to run the following code to check if a number has a decimal place or not −
<html> <head> <title>JavaScript Numbers</title> </head> <body> <script> var num = 10.2; if (num == Math.floor(num)) { alert("Whole Number") } else { alert("Decimal Number") } </script> </body> </html>