70
JavaScript Math asin() method
The JavaScript math asin() method returns the arcsine of the given number in the form of radians. The asin() method must be in the range -1 to 1, otherwise it returns NaN.
Syntax
The asin() method is represented by the following syntax:
Parameter
num – A number.
Return
The arcsine of the number.
JavaScript Math asin() method example
Here, we will understand asin() method through various examples.
Example 1
Let’s see a simple example of asin() method.
Output:
-1.5707963267948966 0 0.5235987755982989 1.5707963267948966
Example 2
Let’s see some cases where asin() method returns NaN.
Output:
NaN NaN NaN
Example 3
Here, you can test asin() method with your own test cases.
Next TopicJavaScript Math