tan

Returns the tangent of a number.

Applies to

Math

Syntax

tan(x)

Parameters

x

A number.

Description

The tan method returns a numeric value that represents the tangent of the angle.

tan is a static method of Math. As a result, you always use it as Math.tan(), rather than as a method of a Math object you create.

Examples

The following function returns the tangent of the variable x:

function getTan(x) {
      return Math.tan(x)
}

If you pass Math.PI/4 to getTan, it returns 0.9999999999999999.