--- title: Math.LN2 slug: Web/JavaScript/Reference/Global_Objects/Math/LN2 translation_of: Web/JavaScript/Reference/Global_Objects/Math/LN2 ---
Math.LN2 属性表示 2 的自然对数,约为 0.693:
由于 LN2 是 Math 的静态属性,所以应该像这样使用:Math.LN2,而不是作为你创建的 Math 实例的属性(Math 不是构造函数)。
Math.LN2下面的函数返回 2 的自然对数:
function getNatLog2() {
return Math.LN2
}
getNatLog2() // 0.6931471805599453
| 规范版本 | 规范状态 | 注解 |
|---|---|---|
| ECMAScript 1st Edition. Implemented in JavaScript 1.0 | Standard | Initial definition. |
| {{SpecName('ES5.1', '#sec-15.8.1.3', 'Math.LN2')}} | {{Spec2('ES5.1')}} | |
| {{SpecName('ES6', '#sec-math.ln2', 'Math.LN2')}} | {{Spec2('ES6')}} |