js的Math对象
数学的运算
里面都是静态方法,可以直接使用Math方法
ceil(x) 对一个数进行上舍入
var mm=10.4;
document.write(Math.ceil(mm));
floor(x) 对一个数进行下舍入
document.write(Math.floor(mm));
round(x) 把一个数四舍五入为最接近的整数
document.write(Math.round(mm));
random() 返回0.0-1.0随机数(伪随机数)
document.write(Math.random());
得到0-9的随机数
document.write(Math.floor(Math.random()*10));