Home >>JavaScript Math Reference >JavaScript cosh() Method

JavaScript cosh() Method

JavaScript cosh() Method

JavaScript cosh() method is used to return the hyperbolic cosine value of a given input number. It accepts only a single parameter which is the given input number for which the value is to be calculated.

Syntax:
Math.cosh(x)

Parameter Values

Parameter Description
x This is a required parameter. It defines the given input number.

Browser Support

Method Chrome Edge Firefox Safari Opera
cosh() 38 12 25 8 25
Here is an example of JavaScript cosh() method:
<html>
<body>
<p>Click the button to see the Output.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
  document.getElementById("demo").innerHTML = Math.cosh(5);
}
</script>
</body>
</html>
Output:

Click the button to see the Output.

Example 2:
<html>
<body>
<p>Click the button to see the Output.</p>
<button onclick="myFunction1()">Try it</button>
<p id="demo1"></p>
<script>
function myFunction1() {
  document.getElementById("demo1").innerHTML = Math.cosh(11);
}
</script>
</body>
</html>
Output:

Click the button to see the Output.