JavaScript cosh

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


HINT: We can get the same result using the below 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 cos to understand the JavaScript Cosine Function.

<!DOCTYPE html>
    <title> Example </title>
  <h1> JavaScriptCOSHFunction </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>
    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);
JavaScript COSH Example