JavaScript Math cosh()

The JavaScript Math.cosh() function returns the hyperbolic cosine of a number.

It is equivalent to (ex + e-x)/2 in mathematics.

The syntax of the Math.cosh() function is:

Math.cosh(x)

cosh(), being a static method, is called using the Math class name.


Math.cosh() Parameters

The Math.cosh() function takes in:

  • x - A number

Return value from Math.cosh()

  • Returns the hyperbolic cosine of the given number.

Example: Using Math.cosh()

// Math.cosh(x) is (e**(x) + e**(-x))/2

var num = Math.cosh(0);
console.log(num); // 1

var num = Math.cosh(1);
console.log(num); // 1.5430806348152437

var num = Math.cosh(-1);
console.log(num); // 1.5430806348152437

var num = Math.cosh(2);
console.log(num); // 3.7621956910836314

Output

1
1.5430806348152437
1.5430806348152437
3.7621956910836314

Recommended readings: