Compute Arcsine

Examples in JavaScript
// Calculates angle of a right-angle triangle in radians
function calcAngle(opposite, hypotenuse) {
  return Math.asin(opposite / hypotenuse);
}

console.log(calcAngle(6, 10));
// expected output: 0.6435011087932844

console.log(calcAngle(5, 3));
// expected output: NaN

Math.asin(-2);  // NaN
Math.asin(-1);  // -1.5707963267948966 (-pi/2)
Math.asin(0);   // 0
Math.asin(0.5); // 0.5235987755982989
Math.asin(1);   // 1.5707963267948966 (pi/2)
Math.asin(2);   // NaN