Math:Math和其他对象不同,不是一个构造函数。它属于一个工具类不用创建对象。
Math.ceil();//向上取整 1.1-->2
Math.floor();//向下取整 1.99-->1
Math.round();//四舍五入取整
Math.random();//0-1之间的随机数,不会出现0,1
生成一个x-y之间的随机数:Math.round(Math.random()*(y-x)+x)
var max=Math.max(1,2,3,4,5)//5
var min = Math.min(1,2,3,4,5,6)//1
Math.pow(x,y)//x^y
Math.sprt(x)//x的平方根