Javascript - Math tan() Method

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

Description

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

Syntax

Math.tan(x)

Parameter Values

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

Return

A Number, representing the tangent of an angle

Example

Return the tangent of a number (angle):

Demo

//display the tangent of the number 90.
console.log(Math.tan(90));//from   ww w . j  a  va  2s. co m

//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);

var x = a + "\n" + b + "\n" + c + "\n" + d;
console.log(x);

Result