JavaScript COSH

The JavaScript COSH function is one of the Math functions, which is used to calculate the trigonometry hyperbolic Cosine for a specified expression. The syntax of the JavaScript COSH Function is:

Math.cosh(number);

HINT: We can get the same result using below JavaScript EXP formula.

(Math.exp(number) + Math.exp(-number)) / 2

JavaScript Cosh Function Example

In this example, We are going to find the JavaScript hyperbolic Cosine values for different data types and display the output. Please refer to JavaScript COS to understand the JavaScript Cosine Function

<!DOCTYPE html>
<html>
<head>
    <title> JavaScript COSH() Function </title>
</head>
<body>
  <h1> JavaScript COSH Function </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.cosh(1);
    document.getElementById("Neg").innerHTML = Math.cosh(-2);
    document.getElementById("Dec").innerHTML = Math.cosh(4.45);
    document.getElementById("Neg_Dec").innerHTML = Math.cosh(-2.75);
    document.getElementById("Str").innerHTML = Math.cosh("JavaScript");
    document.getElementById("Null").innerHTML = Math.cosh(null);
    document.getElementById("Multi").innerHTML = Math.cosh(2 + 9 - 7);
  </script>
</body>
</html>
JavaScript COSH Function