Math.LOG2E

Math.LOG2E 静态数据属性表示 e 以 2 为底的对数,大约为 1.442。

¥The Math.LOG2E static data property represents the base 2 logarithm of e, approximately 1.442.

Try it

¥Value

𝙼𝚊𝚝𝚑.𝙻𝙾𝙶𝟸𝙴 = log 2 ( e ) 1.442 \mathtt{Math.LOG2E} = \log_2(\mathrm{e}) \approx 1.442

Property attributes of Math.LOG2E
Writable no
Enumerable no
Configurable no

描述

¥Description

因为 LOG2EMath 的静态属性,所以你始终将其用作 Math.LOG2E,而不是用作你创建的 Math 对象的属性(Math 不是构造函数)。

¥Because LOG2E is a static property of Math, you always use it as Math.LOG2E, rather than as a property of a Math object you created (Math is not a constructor).

示例

¥Examples

使用 Math.LOG2E

¥Using Math.LOG2E

以下函数返回 e 以 2 为底的对数:

¥The following function returns the base 2 logarithm of e:

js
function getLog2e() {
  return Math.LOG2E;
}

getLog2e(); // 1.4426950408889634

规范

Specification
ECMAScript Language Specification
# sec-math.log2e

¥Specifications

浏览器兼容性

BCD tables only load in the browser

¥Browser compatibility

也可以看看