Math.log2()
函数返回一个数字以 2 为底的对数.
Math.log2(x)
x
如果传入的参数小于 0, 则返回 NaN
.
Math.log2(2) // 1
Math.log2(1024) // 10
Math.log2(1) // 0
Math.log2(0) // -Infinity
Math.log2(-2) // NaN
Math.log2("1024")// 10
Math.log2("foo") // NaN
Specification | Status | Comment |
---|---|---|
ECMAScript 2015 (6th Edition, ECMA-262) Math.log2 |
Standard | Initial definition. |
Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|
Basic support | 未实现 | 25 (25) | 未实现 | 未实现 | 未实现 |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|
Basic support | 未实现 | 未实现 | 25.0 (25) | 未实现 | 未实现 | 未实现 |
Math
对象.