Math.cosh() Method with Example in JavaScript

JavaScript | Math.cosh() Method: Here, we are going to learn about the cosh() method of Math class in JavaScript with Examples.
Submitted by Shivang Yadav, on December 06, 2019

JavaScript | Math.cosh() Method

Math operations in JavaScript are handled using functions of math library in JavaScript. In this tutorial on Math.cosh() method, we will learn about the cosh() method and its working with examples.

Math.cosh() is a function in math library of JavaScript that is used to find the value of hyperbolic cosine of a number.

Syntax:

    Math.cosh(p);

Parameter(s):

  • p – It represents the value whose hyperbolic cosine value to be found.

Return value:

The return type of this method is number, it returns the hyperbolic cosine value of the given p.

Example 1: Find the cosh of numeric values

console.log(Math.cosh(1));
console.log(Math.cosh(22));
console.log(Math.cosh(-2));
console.log(Math.cosh(4.23));

Output

1.5430806348152437
1792456423.065796
3.7621956910836314
34.36589228219746

Example 2: Find the cosh of non-numeric values

console.log(Math.cosh(1 + 2i));
console.log(Math.cosh("Hello"));
console.log(Math.cosh('x'));

Output

Invalid or unexpected token
NaN
NaN

JavaScript Math Object Methods »




Comments and Discussions!

Load comments ↻





Copyright © 2024 www.includehelp.com. All rights reserved.