Home >>JavaScript Math Reference >JavaScript tan() Method

JavaScript tan() Method

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 Values

Parameter Description
x It required a number representing an angle (in radians)

Browser Support

Method Chrome Edge Firefox Safari Opera
tan() Yes Yes Yes Yes Yes
Here is an example of JavaScript tan() Method:
<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>
Output:

Example 2:
<html>
<body>
<script> 
document.write("Output : " + Math.tan(0)); 
</script> 
</body>
</html>
Output:

No Sidebar ads