Home >>JavaScript Math Reference >JavaScript tan() Method
The math.tan() Method in JavaScript is a static method and is used to returns the tangent of the given number and numeric value that represents the tangent of an angle. You can always use it as math.tan(), rather than as a method of a math object created.
Syntax:Math.tan(value)
Parameter | Description |
---|---|
x | It required a number representing an angle (in radians) |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
tan() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <button onclick="mytan()">Click me</button> <p id="Tan"></p> <script> function mytan() { document.getElementById("Tan").innerHTML = Math.tan(85); } </script> </body> </html>
<html> <body> <script> document.write("Output : " + Math.tan(0)); </script> </body> </html>