Math.tan()
Returns the tangent of an angle given in radians.
Syntax
Math.tan(x) Parameters
| Name | Type | Required | Description |
|---|---|---|---|
x | number | Yes | The angle in radians. |
Returns
number — The tangent of x.
Examples
console.log(Math.tan(0));
Output
0
console.log(Math.round(Math.tan(Math.PI / 4)));
Output
1
Notes
The argument is in radians. Near odd multiples of PI/2 the result becomes a
very large (but finite) number due to floating-point limits.
Browser & runtime support
| Environment | Since version |
|---|---|
| chrome | 1.0 |
| firefox | 1.0 |
| safari | 1.0 |
| edge | 12 |
| node | 0.10 |