JavaScript Tutorial JavaScript References

JavaScript - Math.asin() Method



The JavaScript Math.asin() method returns arc sine of a value. The return value will be in the range -𝜋/2 through 𝜋/2.

Syntax

Math.asin(x)

Parameters

x Specify the value in range [-1, 1].

Return Value

Returns the arc sine of the value.
If the x is not in the range of [-1, 1], it returns NaN.

Example:

In the example below, Math.asin() method is used to find out the arc sine of a given value.

var txt;

txt = "Math.asin(0.25) = " + Math.asin(0.25) + "<br>";
txt = txt + "Math.asin(0.5) = " + Math.asin(0.5) + "<br>";
txt = txt + "Math.asin(1) = " + Math.asin(1) + "<br>";

The output (value of txt) after running above script will be:

Math.asin(0.25) = 0.25268025514207865
Math.asin(0.5) = 0.5235987755982989
Math.asin(1) = 1.5707963267948966

❮ JavaScript - Math Object

5