Home »
JavaScript
Math.asin() Method with Example in JavaScript
JavaScript | Math.asin() Method: Here, we are going to learn about the asin() method of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on February 03, 2020
JavaScript | Math.asin() Method
Math.asin() is a function in math library of JavaScript that is used to find the value of arcsine of a number and return the value in radians.
The values accpeted are y such that y = sin(x)
Syntax:
Math.asin(x);
Parameter(s):
- x – It represents the value whose arcsine value to be found.
Return value:
The return type of this method is number, it returns the arcsine value of the given x.
Values accepted: Integer, floating-point, numeric string.
Invalid Values: non-numeric string, empty variable, empty array all will return NaN (Not a Number).
Browser support: Chrome, Internet asinlorer, Mozilla, Safari, Opera mini.
Example 1: Valid values
console.log(Math.asin(-1));
console.log(Math.asin(0.1));
console.log(Math.asin(0));
console.log(Math.asin("0.65"));
Output
-1.5707963267948966
0.1001674211615598
0
0.7075844367253556
Example 2: Invalid values
console.log(Math.asin("Javascript"));
console.log(Math.asin(2));
Output
NaN
NaN
JavaScript Math Object Methods »