JavaScript Tutorial JavaScript References

JavaScript - Math.atan() Method



The JavaScript Math.atan() method returns arc tangent of a value. The returned value will be in the range -𝜋/2 through 𝜋/2.

Syntax

Math.atan(x)

Parameters

x Specify the value.

Return Value

Returns the arc tangent of the value.

Example:

In the example below, Math.atan() method is used to find out the arc tangent of a given value.

var txt;

txt = "Math.atan(0.5) = " + Math.atan(0.5) + "<br>";
txt = txt + "Math.atan(1) = " + Math.atan(1) + "<br>";
txt = txt + "Math.atan(2) = " + Math.atan(2) + "<br>";

The output (value of txt) after running above script will be:

Math.atan(0.5) = 0.4636476090008061
Math.atan(1) = 0.7853981633974483
Math.atan(2) = 1.1071487177940904

❮ JavaScript - Math Object