Latest

recent

JavaScript tan() Method

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

In this example we will get 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
JavaScript tan() Method Reviewed by 1000sourcecodes on 02:26 Rating: 5
Powered by Blogger.