Math.asin()

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 Math.asin() statische Methode gibt den Arkussinus (in Radiant) einer Zahl zurück. Das bedeutet,

x[1,1],𝙼𝚊𝚝𝚑.𝚊𝚜𝚒𝚗(𝚡)=arcsin(x)=die eindeutige y[π2,π2] so dass sin(y)=x\forall x \in [{-1}, 1],\;\mathtt{\operatorname{Math.asin}(x)}} = \arcsin(x) = \text{die eindeutige } y \in \left[-\frac{\pi}{2}, \frac{\pi}{2}\right] \text{ so dass } \sin(y) = x

Probieren Sie es aus

// Calculates angle of a right-angle triangle in radians
function calcAngle(opposite, hypotenuse) {
  return Math.asin(opposite / hypotenuse);
}

console.log(calcAngle(6, 10));
// Expected output: 0.6435011087932844

console.log(calcAngle(5, 3));
// Expected output: NaN

Syntax

js
Math.asin(x)

Parameter

x

Eine Zahl zwischen -1 und 1 (inklusive), die den Sinuswert eines Winkels darstellt.

Rückgabewert

Der Arkussinus (Winkel in Radiant zwischen -π2-\frac{\pi}{2} und π2\frac{\pi}{2}, inklusive) von x. Wenn x kleiner als -1 oder größer als 1 ist, wird NaN zurückgegeben.

Beschreibung

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

Beispiele

Verwendung von Math.asin()

js
Math.asin(-2); // NaN
Math.asin(-1); // -1.5707963267948966 (-π/2)
Math.asin(-0); // -0
Math.asin(0); // 0
Math.asin(0.5); // 0.5235987755982989 (π/6)
Math.asin(1); // 1.5707963267948966 (π/2)
Math.asin(2); // NaN

Spezifikationen

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

Browser-Kompatibilität

Siehe auch