Home >>JavaScript Math Reference >JavaScript tanh() Method
JavaScript math.tanh() method is a static method of math and is used to return the hyperbolic tangent of the given number by calculating the value. You can always used as math.tanh (), rather than you created as a method of a math object.
Syntax:Math.tanh(p)
Parameter | Description |
---|---|
x | It required a number |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
tanh() | 38 | 12 | 25 | 8 | 25 |
<html> <body> <button onclick="myTanh()">Click me</button> <p id="tanh"></p> <script> function myTanh() { document.getElementById("tanh").innerHTML = Math.tanh(4); } </script> </body> </html>
<html> <body> <script> document.writeln(Math.tanh(-2)+"<br>"); document.writeln(Math.tanh(0)+"<br>"); document.writeln(Math.tanh(0.8)+"<br>"); document.writeln(Math.tanh(4)); </script> </body> </html>