1、max 返回最大值
document.write(Math.max(4,9,100)); //返回100
2、min 返回最小值
document.write(Math.min(-3,-6,-99)); //返回-99
3、ceil 向上取整
document.write(Math.ceil(-25.1)); //返回-25
4、floor 向下取整
document.write(Math.floor(25.999)); //返回25
5、round 四舍五入取整数,但负数的时候, 但小数小于5的时候,是舍去不是五入,为-25
document.write(Math.round(-25.5)); //返回-25
6、random 返回0.0~1之间的随机数,包括0但不包括1
document.write(Math.random());
公式:Math.floor(Math.random()*(max-min+1))+min 包含最大值和最小值
Math.floor(Math.random()*(max-min)+min 不含最大值但含最小值
7、pow 两个参数,第一个是底数,第二个是几次方
document.write(Math.pow(4,3)); //4*4*4
8、abs 返回一个数的绝对值
document.write(Math.abs(-8)); //8