Javascript - Math asin() Method

The asin() method returns the arcsine of a number as a value between -PI/2 and PI/2 radians.

Description

The asin() method returns the arcsine of a number as a value between -PI/2 and PI/2 radians.

If the parameter x is outside the range -1 to 1, the browser will return NaN.

1 for the value of PI/2.

-1 for the value of -PI/2.

Syntax

Math.asin(x)

Parameter Values

Parameter RequireDescription
x Required. A number

Return

A Number, from -PI/2 to PI/2, or NaN if the value is outside the range of -1 to 1

Example

Return the arcsine of a number:

Demo

//display the arcsine of 0.5
console.log(Math.asin(0.5));//w  ww .  ja va 2s . co m
console.log(Math.asin(0));
console.log(Math.asin(1));

Result