From http://www.w3schools.com (Copyright Refsnes Data)

JavaScript tan() Method


Math Object Reference JavaScript Math Object

Definition and Usage

The tan() method returns a number that represents the tangent of an angle.

Syntax

Math.tan(x)

Parameter Description
x Required. A number


Example

Example

Return the tangent of different numbers:

<script type="text/javascript">

document.write(Math.tan(0.50) + "<br />");
document.write(Math.tan(-0.50) + "<br />");
document.write(Math.tan(5) + "<br />");
document.write(Math.tan(10) + "<br />");
document.write(Math.tan(-5) + "<br />");
document.write(Math.tan(-10));

</script>

The output of the code above will be:

0.5463024898437905
-0.5463024898437905
-3.380515006246586
0.6483608274590866
3.380515006246586
-0.6483608274590866

Try it yourself »


Math Object Reference JavaScript Math Object

From http://www.w3schools.com (Copyright Refsnes Data)