JS Built-ins
← Math60 / 215
Mathasinintermediate

Math.asin() Out of Domain Returns NaN

πŸ“– Usage Example
// Inverse sine β€” result in radians
Math.asin(0)   // β†’ 0
Math.asin(1)   // β†’ 1.5707... (Ο€/2)

Use Math.asin() to find the angle (in radians) whose sine equals a given value.

Math.asin(x)

Math.asin() is only defined for inputs in [-1, 1]. Values outside this range return NaN.

Challenge: Verify that Math.asin(2) returns NaN.

πŸ’‘ Hints (2)
  • β€’ The domain of asin is [-1, 1]
  • β€’ NaN is the only JavaScript value where x !== x