Math.pow(2,53) //=> 9007199254740992:2的53次方
Math.round(.6) //=>1.0:舍入到最接近的整数
Math.ceil(.6) //=>1.0:向上舍入到一个整数
Math.floor(.6) //=> 0.0:向下舍入到一个整数
Math.abs(-5) //=>5:绝对值
Math.max(x,y,z) // 返回最大的参数
Math.min(x,y,z) // 返回最小的参数
Math.random() //伪随机数x,其中@≤x<1.0
Math.PI //T:圆周率
Math.E //e:自然对数的底数
Math.sqrt(3) //=>3**0.5:3的平方根
Math.pow(3,1/3) //=> 3**(1/3):3的立方根
Math.sin(0) //三角函数:还有 Math.cos、Math.atan 等
Math.log(10) //10的自然对数
Math.log(100)/Math.LN10 //以10为底 100的对数
Math.log(512)/Math.LN2 //以2为底512的对数
Math.exp(3) // Math.E的立方
JavaScript Math对象常用属性
最新推荐文章于 2024-07-25 09:24:40 发布