Home >>JavaScript Math Reference >JavaScript atan() Method
JavaScript atan() method is used to return the arctangent value of a given input number. It returns a numeric value between -PI/2 and PI/2 radian as a result.
Syntax:Math.atan(x)
Parameter | Description |
---|---|
x | This is a required parameter. It defines the given input number. |
Method | Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|---|
atan() | Yes | Yes | Yes | Yes | Yes |
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { document.getElementById("demo").innerHTML = Math.atan(2); } </script> </body> </html>
Click the button to see the Output.
<html> <body> <p>Click the button to see the Output.</p> <button onclick="myFunction1()">Try it</button> <p id="demo1"></p> <script> function myFunction1() { document.getElementById("demo1").innerHTML = Math.atan(1); } </script> </body> </html>
Click the button to see the Output.