132
JavaScript Math tan() method
The JavaScript math tan() method returns the tangent of the given number that represents the tangent of an angle.
Syntax
The tan() method is represented by the following syntax:
Parameter
num – A number.
Return
A number that represents the tangent of the angle.
JavaScript Math tan() method example
Here, we will understand tan() method through various examples.
Example 1
Let’s see a simple example of tan() method.
Output:
1.5574077246549023 -2.185039863261519
Example 2
In this example, we will use tan() method with negative numbers.
Output:
-1.5574077246549023 -0.5463024898437905
Example 3
Let’s see tan() method with some different test cases.
Output:
0 -1.2246467991473532e-16
Example 4
Here, you can test tan() method with your own test cases.
Next TopicJavaScript Math