Javascript examples for Math:atan
The atan() method returns the arctangent of a number as a value between -PI/2 and PI/2 radians.
Parameter | Description |
---|---|
x | Required. A number |
A Number, from -PI/2 to PI/2, or NaN if the value is empty
The following code shows how to return the arctangent of a specified number:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/* w w w. ja v a 2 s.c om*/ document.getElementById("demo").innerHTML = Math.atan2(8, 4); } </script> </body> </html>