In JavaScript, Math
is a built-in object that contains different methods and properties used to perform mathematical operations. It contains an asin()
function, which is used to compute the arc sine of a specified number. This is also known as the inverse sine of a number.
Math.asin(param);
param
: This is a number representing the sine value. It is the input value of type Number
for which we want to find the asin()
. Its range is:
Number
in JavaScript is a 64-bit double-precision value which is the same asdouble
in C# or Java.
Number
: It returns the angle θ whose sine is equal to the given param
. It is of the Number
type. Its range is:
NaN
: The function returns NaN
if:
param
< -1param
> 1To convert radians to degrees, use the following formula:
- Degrees = Radians × 180 / π
where
π
= 3.14159, approximately
console.log("asin(-1) = " + Math.asin(-1));console.log("asin(0) = " + Math.asin(0));console.log("asin(1) = " + Math.asin(1));console.log("asin(0.5) = " + Math.asin(0.5));console.log("asin(-2) = " + Math.asin(-2));console.log("asin(2) = " + Math.asin(2));