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,
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
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 und , 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()
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
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
asin |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support