JS具有用于典型计算Math的全局对象
有几个平时用于计算的方法,这里详细介绍几个常用的
math.floor(x ) /返回小于x的最大整数
math.floor(12.2 )/12
math.floor(15/2 )/7
math.ceil(x ) /返回大于x的最小整数
math.ceil(12.2 )/13
math.Ceil(15/2月2日)/8日
Math.round ()返回四舍五入后的整数
math.round(12.2 )/12
math.round(15/2 )/8
Math.random ()返回介于0和1之间的伪随机数。
math.cos(x )返回x的余弦值
math.sin(x )返回x的正弦值