Math对象方法

方法 描述 语法
round(x) 四舍五入 Math.round(x)
ceil(x) 对x进行上舍入 Math.ceil(x)
floor(x) 对x进行下舍入 Math.floor(x)
random() 0~1之间(不包括1)的一个随机数 Math.random()
sqrt(x) 返回x的平方根 Math.sqrt(x)