Latest web development tutorials

JavaScript tan () method

Math Object Reference JavaScript Math Object

Examples

It returns a tangent of a number of angles:

Math.tan(90);

Output:

-1.995200412208242

try it"

Definition and Usage

tan () method returns a digital representation of a tangent of the angle.


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support tan () method


grammar

Math.tan( x )

Parameter Value

参数 描述
x 必需。一个以弧度表示的角。将角度乘以 0.017453293 (2PI/360)即可转换为弧度。

return value

类型 描述
Number 角度的正切值

technical details

JavaScript version: 1.0


More examples

Examples

In this example, we will calculate the tangent different numbers:

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

a, b, c, and d output:

-1.995200412208242
1.995200412208242
1.6197751905438615
0.320040389379563

try it"


Math Object Reference JavaScript Math Object