JavaScript acosh

The JavaScript acosh function is a Math function that calculates the trigonometric hyperbolic Arc cosine for a specified expression. The acosh() method is also called the inverse hyperbolic cosine function.

The syntax of the acosh() method is shown below.

Math.acosh(number);

Return Value: The acosh() method accepts a number and returns the inverse hyperbolic cosine value of it.

JavaScript acosh Function Example

In the following example, we find the JavaScript hyperbolic Arc Cosine values of different data types and display the output.

<!DOCTYPE html>
<html>
<head>
    <title> JavaScriptACOSHFunction </title>
</head>
<body>
  <h1> JavaScriptACOSHFunction </h1>
  <p id = "Pos"></p>
  <p id = "Neg"></p>
  <p id = "Dec"></p>
  <p id = "Neg_Dec"></p>
  <p id = "Str"></p>
  <p id = "Exp"></p>
  <p id = "Null"></p>
  <p id = "Multi"></p>
  <script>
    document.getElementById("Pos").innerHTML = Math.acosh(10);
    document.getElementById("Neg").innerHTML = Math.acosh(-20);
    document.getElementById("Dec").innerHTML = Math.acosh(14.45);
    document.getElementById("Neg_Dec").innerHTML = Math.acosh(-12.75);
    document.getElementById("Str").innerHTML = Math.acosh("JavaScript");
    document.getElementById("Null").innerHTML = Math.acosh(null);
    document.getElementById("Multi").innerHTML = Math.acosh(25 + 55 - 37);
  </script>
</body>
</html>
JavaScript acosh Function Example

TIP: Please refer to the cos(), cosh(), and acos() functions in a Math article for the cosine, hyperbolic cosine, and arc cosine values.

Example 2: If we use the acosh() function to find the hyperbolic arc cosine value of positive and negative 0, it returns NaN.

console.log(Math.acosh(0));
console.log(Math.acosh(-0));
NaN 
NaN

Example 3: Similar to the above, if we use the acosh() on negative infinity or a NaN value, it returns NaN. However, for the positive infinity, the acosh() function returns Infinity as the output.

let a = Infinity;
let b = -Infinity;
let c = NaN;
console.log(Math.acosh(a));
console.log(Math.acosh(b));
console.log(Math.acosh(c));
Infinity 
NaN 
NaN