Math对象的方法
序号方法用处
1Math.abs(num)绝对值2Math.round(num)四舍五入3Math.floor(num)向下取整,==parseInt4Math.ceil()向上取整5Math.pow(x, y)求x的y次方结果6Math.sqrt(x)开平方7Math.max(...argunments)求最大值8Math.min(...arguments)求最小值9Math.random()随机数,返回 0-1之间的随机数
补充:
Math.round(num * 1000) / 1000该方法默认是保留整数部分,乘除后可根据0的个数保留小数位
paeseInt(Math.random()* (a - b)+ b) [a, b)
parseInt(Math.random()* (a - b + 1)+ b) [a, b]