Math称为数学函数,但是它属于对象类型typeof Math =》 ‘object’
之所以叫做数学函数,因为Math这个对象中提供了很多操作数字的方法
Math中提供的常用方法Math.XXX(n)
abs: 取绝对值,
ceil/floor: 向上/向下取整
1  | Math.ceil(10.01) =>11  | 
round: 四舍五入(正数.5向上,负数.5向下)
sqrt: 开平方
pow: 取幂  (n的m次方)
1  | Math.pow(2,10) =>1024  | 
max/min: 取最大值、取最小值
1  | Math.max(1,2,3,4) //4  | 
PI:获取圆周率
random:获取0-1之间的随机小数
Math.round(Math.random()*(m-n)+n):获取n->m之间的随机正整数