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.
Math.asin()
정적 메서드는 숫자의 역사인(라디안 단위)을 반환합니다.
시도해보기
// 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
구문
js
Math.asin(x)
매개 변수
x
-
각도의 사인 값을 나타내는 -1 이상 1 이하의 숫자.
반환 값
x
의 역사인(라디안 단위의 각도가 이상 이하).
만약 x
가 -1 미만이거나 1 초과인 경우 NaN
을 반환합니다.
설명
asin()
은 Math
의 정적 메서드이므로, 생성한 Math
객체의 메서드가 아니라 항상 Math.ataasinn()
으로 사용합니다(Math
는 생성자가 아닙니다).
예제
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
명세서
Specification |
---|
ECMAScript® 2025 Language Specification # sec-math.asin |
브라우저 호환성
BCD tables only load in the browser