The tan() method returns a number that represents the tangent of an angle.
The tan() method returns a number that represents the tangent of an angle.
Math.tan(x)
Parameter | Require | Description |
---|---|---|
x | Required. | A number representing an angle (in radians) |
A Number, representing the tangent of an angle
Return the tangent of a number (angle):
//display the tangent of the number 90. console.log(Math.tan(90));/*from w ww . java 2s .c o 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);