js中的单体内置对象
Global,Math
Math的方法
min(),min()用于确定一组数值中的最大值和最小值。
var max = Math.max(3,54,5,6);
console.log(max); //max = 54
var value = [1,2,3,4,5,6,7,8,9];
var max = Math.Max.apply(Math,value);
Math.ceil(); //向上舍入
Math.floor(); //向下舍入
Math.round(); //四舍五入
Math.random(); //返回一个大于等于0;小于1的随机数
console.log( Math.floor(Math.random()*9 +2));//随机输出2到10的整数
Math.abs(num); //返回绝对值
Math.exp(num); //返回Math.E的num次幂
Math.log(num); //num的自然对数
Math.pow(num,power);//num的power次幂
Math.sqrt(num); //num的平方根