Latest web development tutorials
 

JavaScript tan() Method

< JavaScript Math Object

Example

Return the tangent of a number (angle):

Math.tan(90);

The result will be:

-1.995200412208242
Try it Yourself »

More "Try it Yourself" examples below.


Definition and Usage

The tan() method returns a number that represents the tangent of an angle.


Browser Support

Method
tan() Yes Yes Yes Yes Yes

Syntax

Math.tan(x)

Parameter Values

Parameter Description
x Required. A number representing an angle (in radians)

Technical Details

Return Value: A Number, representing the tangent of an angle
JavaScript Version: 1.0

Examples

More Examples

Example

Return the tangent of different angles:

var a = Math.tan(90);
var b = Math.tan(-90);
var c = Math.tan(45);
var d = Math.tan(60);

The result of a,b,c, and d will be:

-1.995200412208242
1.995200412208242
1.6197751905438615
0.320040389379563
Try it Yourself »

< JavaScript Math Object