JavaScript tan() Method
Example
Return a number representing the tangent of an angle:
Math.tan(90);
Output result:
-1.995200412208242
Try it »
Definition and Usage
The tan() method returns a number representing the tangent of an angle.
Browser support





All major browsers support the tan() method.
Syntax
Math.tan(
x
)
Parameter value
| Parameters | Description |
|---|---|
| x | Required. An angle expressed in radians. Multiply the angle by 0.017453293 (2PI/360) to convert it to radians. |
Return Value
| Type | Description |
|---|---|
| Number | The tangent of an angle |
Technical Details
| JavaScript version: | 1.0 |
|---|
More examples
Example
In this example, we will calculate the tangent of different numbers:
var a=Math.tan(90);
var b=Math.tan(-90);
var c=Math.tan(45);
var d=Math.tan(60);
a,b,c, and LinkedHashMap, among others. d Output result:
-1.995200412208242
1.995200412208242
1.6197751905438615
0.320040389379563
Try it »
JavaScript Math object