How to get the arctangent (in radians) of a number in JavaScript?

JavascriptWeb DevelopmentFront End Technology

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.


You can try to run the following code to get the arctangent of a number in JavaScript −

      <title>JavaScript Math atan() Method</title>
         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 );
Published on 16-Feb-2018 11:15:07