JavaScript Math.tan()
Examples
Math.tan(Math.PI);
Math.tan(x) expect x in radians.
To use degrees, convert degrees to radians first.
Math.tan(radians);
Description
TheMath.tan() method returns the tangent of a number.
TheMath.tan() method expects the number in radians.
Based on sine and cosine:Math.tan(x) = Math.sin(x) / Math.cos(x).
What is Radians?
Radians is an angle'sα amount of rotationb on a circle:

| Degrees | PI | Radians |
|---|---|---|
| 0° | 0 | 0 |
| 1° | PI/180 | 0.0175 |
| 30° | PI/6 | 0.52 |
| 45° | PI/4 | 0.79 |
| 90° | PI/2 | 1.57 |
| 180° | PI | 3.14 |
| 360° | PI*2 | 6.28 |
JavaScript Tangent Methods:
The Math.tan() MethodThe Math.tanh() Method
The Math.atan() Method
The Math.atan2() Method
The Math.atanh() Method
Sine and Cosine Methods:
The Math.sin() MethodThe Math.cos() Method
Syntax
Parameters
| Parameter | Description |
| x | Required. A number representing radians. |
Return Value
| Type | Description |
| Number | The tangent of the number.NaN if the number is empty or not numeric. |
The Pythagoran Therorem
Math.sin(),Math.cos(),andMath.tan() are related to the Pythagorean theorem:

Theorem: c2 = a2 + b2
The sineMath.sin() to the angle isa / c.
The cosineMath.cos() to the angle isb / c.
The tangentMath.tan() to the angle isa / b.
Browser Support
Math.tan() is an ECMAScript1 (JavaScript 1997) feature.
It is supported in all browsers:
| Chrome | Edge | Firefox | Safari | Opera |

