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:

Math.cosh(number);

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>
<html>
<head>
    <title> Example </title>
</head>
<body>
  <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>
  <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 Example

About Suresh

Suresh is the founder of TutorialGateway and a freelance software developer. He specialized in Designing and Developing Windows and Web applications. The experience he gained in Programming and BI integration, and reporting tools translates into this blog. You can find him on Facebook or Twitter.