数学 Math

注:测试参数可以是小数
方法 描述
Math.random() 随机数,0-1之间的小数
Math.min(x,...) 返回参数中的最小值
Math.max(x,...) 返回参数中的最大值
Math.floor(x) 返回整数(舍小数)
Math.ceil(x) 返回整数(小数>0,整数+1)
Math.round(x) 返回整数(四舍五入,小数>=0.5,整数+1)
Math.abs(x) 返回正值
Math.sqrt(x) 返回平方根
Math.pow(x, n) 返回x的n次方