Math.tan()

Returns the tangent of an angle given in radians.

Since ES1 Spec ↗

Syntax

Math.tan(x)

Parameters

NameTypeRequiredDescription
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

EnvironmentSince version
chrome 1.0
firefox 1.0
safari 1.0
edge 12
node 0.10

See also