Math.SQRT1_2

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.SQRT1_2 repräsentiert die Quadratwurzel von 1/2, was ungefähr 0,707 entspricht.

Probieren Sie es aus

function getRoot1Over2() {
  return Math.SQRT1_2;
}

console.log(getRoot1Over2());
// Expected output: 0.7071067811865476

Wert

𝙼𝚊𝚝𝚑.𝚂𝚀𝚁𝚃𝟷_𝟸=120.707\mathtt{Math.SQRT1_2} = \sqrt{\frac{1}{2}} \approx 0.707
Eigenschaften von Math.SQRT1_2
Schreibbarnein
Aufzählbarnein
Konfigurierbarnein

Beschreibung

Math.SQRT1_2 ist eine Konstante und eine leistungsfähigere Alternative zu Math.sqrt(0.5).

Da SQRT1_2 eine statische Eigenschaft von Math ist, wird sie immer als Math.SQRT1_2 verwendet, anstatt als Eigenschaft eines selbst erstellten Math-Objekts (Math ist kein Konstruktor).

Beispiele

Verwendung von Math.SQRT1_2

Die folgende Funktion gibt 1 über die Quadratwurzel von 2 zurück:

js
function getRoot1_2() {
  return Math.SQRT1_2;
}

getRoot1_2(); // 0.7071067811865476

Spezifikationen

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

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
SQRT1_2

Legend

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

Full support
Full support

Siehe auch