C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
JavaScript Math cosh() methodThe JavaScript math cosh() method returns the hyperbolic cosine of the given number. SyntaxThe cosh() method is represented by the following syntax: Math.cosh(num) Parameternum - A number. ReturnThe hyperbolic cosine of a number. JavaScript Math cosh() method exampleHere, we will understand cosh() method through various examples. Example 1Let's see a simple example of cosh() method. <script> document.writeln(Math.cosh(-1)+"<br>"); document.writeln(Math.cosh(0)+"<br>"); document.writeln(Math.cosh(0.5)+"<br>"); document.writeln(Math.cosh(2)); </script> Output: 1.5430806348152437 1 1.1276259652063807 3.7621956910836314 Example 2Here, you can test cosh() method with your own test cases. <script> function display() { var x=document.getElementById("num").value; document.getElementById("result").innerHTML=Math.cosh(x); } </script> <form> Enter a number: <input type="text" id="num"> <input type="button" onclick="display()" value="submit"> </form> <p><span id="result"></span></p>
Next TopicJavaScript Math
|