Math.LN2

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.

Die statische Dateneigenschaft Math.LN2 repräsentiert den natürlichen Logarithmus von 2, ungefähr 0,693:

Probieren Sie es aus

function getNatLog2() {
  return Math.LN2;
}

console.log(getNatLog2());
// Expected output: 0.6931471805599453

Wert

𝙼𝚊𝚝𝚑.𝙻𝙽𝟸=ln(2)0.693\mathtt{Math.LN2} = \ln(2) \approx 0.693
Eigenschaften von Math.LN2
Schreibbarnein
Aufzählbarnein
Konfigurierbarnein

Beschreibung

Da LN2 eine statische Eigenschaft von Math ist, wird sie immer als Math.LN2 verwendet und nicht als Eigenschaft eines von Ihnen erstellten Math-Objekts (Math ist kein Konstruktor).

Beispiele

Verwendung von Math.LN2

Die folgende Funktion gibt den natürlichen Logarithmus von 2 zurück:

js
function getNatLog2() {
  return Math.LN2;
}

getNatLog2(); // 0.6931471805599453

Spezifikationen

Specification
ECMAScript® 2025 Language Specification
# sec-math.ln2

Browser-Kompatibilität

Report problems with this compatibility data on GitHub
desktopmobileserver
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
Deno
Node.js
LN2

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support

Siehe auch