To get the arctangent of a number, use the atan() method in JavaScript. This method returns the arctangent in radians of a number. The atan method returns a numeric value between -pi/2 and pi/2 radians.
Example
You can try to run the following code to get the arctangent of a number in JavaScript −
<html> <head> <title>JavaScript Math atan() Method</title> </head> <body> <script> var value = Math.atan(-1); document.write("First Value : " + value ); value = Math.atan(.5); document.write("<br />Second Value : " + value ); value = Math.atan(30); document.write("<br />Third Value : " + value ); var value = Math.atan("Demo Text"); document.write("<br />Fourth Value : " + value ); </script> </body> </html>