tan (JavaScript)

Gets the tangent of an angle.

Defined in

Math (JavaScript)

Syntax

tan(value:double) : double
Parameter Description
value An angle in radians. See below for special cases. See rad (JavaScript) to convert degrees to radians.
Return value Description
double The tangent of the parameter.

Usage

Special cases are as follows:
  • The tangent of NaN or infinity is NaN.
  • The tangent of +0 is positive zero.
  • The tangent of -0 is negative zero.

Examples

This button onclick event calculates the adjacent leg of a right triangle given an angle in degrees and the length of the opposite leg.
sessionScope.a = 
	Math.tan(Math.rad(sessionScope.angleA)) * sessionScope.b