atan()  Math  class method JS Home  <<  JS Reference  <<  Math  <<  atan()


Returns the arctangent of a number in radians between -PI/2 and PI/2.

  • Radians to Degrees - divide number by (Math.PI / 180).
  • Degrees to Radians - multiply number by (Math.PI * 180).
  • Like all class methods atan() should be used on the class rather than an instance of the class.


Signature Description
Math.atan(value)Returns the absolute value of a number.


Parameter Description
valueThe value you wish to find the arctangent in radians for:
  • Invalid values or no value passed return NaN.


The code below displays atan() usage.

// Store results in an array.
var atanValues = new Array(6);

atanValues[0] = Math.atan(-1);
atanValues[1] = Math.atan(0);
atanValues[2] = Math.atan(0.75);
atanValues[3] = Math.atan(-2);
atanValues[4] = Math.atan('a string');
atanValues[5] = Math.atan();


Press the button below to action the above code:

Related Tutorials

JavaScript Advanced Tutorials - Lesson 4 - Math