Math.acos():返回數字的Math.acos()反餘弦值(以弧度為單位)

Math.acos():返回數字的Math.acos()反餘弦值(以弧度為單位)

// 以弧度計算直角三角形的角度
function calcAngle(adjacent, hypotenuse) {
  return Math.acos(adjacent / hypotenuse);
}

console.log(calcAngle(8, 10));
// Expected output: 0.6435011087932843

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