Posts: 3,985
Name: Abel Mohler
Location: Asheville, North Carolina USA
|
There is a round method in the Math() object that works like this:
Code:
var x=1.1;
x=Math.round(x);
alert(x);
will alert 1.
To see if a number is a whole number, you simply compare it to a rounded version of itself.
|