Math对象
Math对象没有构造函数,不能使用new创建实例
- Math.abs() 取绝对值
- Math.ceil() 向上取整
- Math.floor() 向下取整(x)
- Math.log() 以2为底数
- Math.max(num1,num2,num3…) 返回最大的数
- Math.min(num1,num2,num3…) 返回最小的数
- Math.pow(x,n) 乘方x^n
- Math.round() 四舍五入
- Math.sqrt() 开方
- Math.sin(x)
- Math.cos(x) x是弧度制的 eg:PI/3
- Math.random() 取0-1的随机数
- 取随机数
Math.round(Math.random()*100) //取值范围为0-100 Math.floor(Math.random()*100) <