What is Math.asin() in JavaScript?

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.

Syntax

Math.asin(param);

Parameter

  • 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:
    • -1 <= param <= 1

Number in JavaScript is a 64-bit double-precision value which is the same as double in C# or Java.

Return value

  • Number: It returns the angle θ whose sine is equal to the given param. It is of the Number type. Its range is:

    • π/2 <= θ <= π/2 (radians)
  • NaN: The function returns NaN if:

    • param < -1
    • param > 1

To convert radians to degrees, use the following formula:

  • Degrees = Radians × 180 / π

where π = 3.14159, approximately

Example

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));

Free Resources