Home » JavaScript Math tan() Method

JavaScript Math tan() Method

by Online Tutorials Library

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.

Test it Now

Output:

1.5574077246549023  -2.185039863261519  

Example 2

In this example, we will use tan() method with negative numbers.

Test it Now

Output:

-1.5574077246549023  -0.5463024898437905  

Example 3

Let’s see tan() method with some different test cases.

Test it Now

Output:

0  -1.2246467991473532e-16  

Example 4

Here, you can test tan() method with your own test cases.

Test it Now

Next TopicJavaScript Math

You may also like