Javascript examples for Math:tan
The tan() method returns the tangent of an angle.
Parameter | Description |
---|---|
x | Required. A number representing an angle (in radians) |
A Number, representing the tangent of an angle
The following code shows how to return the tangent of a number (angle):
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from w w w . j a v a 2 s .co m*/ var a = Math.tan(90); var b = Math.tan(-90); var c = Math.tan(45); var d = Math.tan(60); var x = a + "<br>" + b + "<br>" + c + "<br>" + d; document.getElementById("demo").innerHTML = x; } </script> </body> </html>