JavaScript Tutorial JavaScript References

JavaScript - Math.cosh() Method



The JavaScript Math.cosh() method returns hyperbolic cosine of a value. The hyperbolic cosine of x is defined as:

cosh

where e is an Euler's number.

Syntax

Math.cosh(x)

Parameters

x Specify the value.

Return Value

Returns the hyperbolic cosine of a value.

Example:

In the example below, Math.cosh() method is used to find out the hyperbolic cosine of a value.

var txt;

txt = "Math.cosh(0) = " + Math.cosh(0) + "<br>";
txt = txt + "Math.cosh(2) = " + Math.cosh(2) + "<br>";
txt = txt + "Math.cosh(4) = " + Math.cosh(4) + "<br>";
txt = txt + "Math.cosh(-2) = " + Math.cosh(-2) + "<br>";
txt = txt + "Math.cosh(-4) = " + Math.cosh(-4) + "<br>";

The output (value of txt) after running above script will be:

Math.cosh(0) = 1
Math.cosh(2) = 3.7621956910836314
Math.cosh(4) = 27.308232836016487
Math.cosh(-2) = 3.7621956910836314
Math.cosh(-4) = 27.308232836016487

❮ JavaScript - Math Object