1、三次方函数 Math.pow()
2、绝对值函数 Math.abs(a,b):a为要操作的数,b决定取几次方
3、向上取整 Math.ceil()
4、向下取整 Math.floor()
5、四舍五入 Math.round()
6、找最大值 Math.max()
7、找最小值 Math.min()
8、产生随机数 Math.random()
产生0-1之间的随机数,前开后闭,即包含0不含1:
var b = Math.random();
document.write(b);
要产生处于[min,max]之间的随机数可以用:Math.floor(Math.random()*(max-min+1)+min);
产生0-9之间的随机数,可根据需要自行设置max和min的值:
var b = Math.floor(Math.random()*10);
9、正弦函数 Math.sin()
10、余弦函数 Math.cos()
11、Math.sqrt() 求平方根
12、Math.log()函数获得任意数字的对数