JavaScript Math atan() method

The JavaScript math atan() method returns the arctangent of the given number in the form of radians. The value returned by atan() method lies between -Math.PI/2 to Math.PI/2.

Syntax

The atan() method is represented by the following syntax:

Parameter

num - A number.

Return

The arctangent of the number.

JavaScript Math atan() method example

Here, we will understand atan() method through various examples.

Example 1

Let's see a simple example of atan() method.

Test it Now

Output:

-0.7853981633974483
0
0.4636476090008061
0.7853981633974483

Example 2

Let's see an example of atan() method that contains infinity as an argument.

Test it Now

Output:

1.5707963267948966
-1.5707963267948966

Example 3

Here, you can test atan() method with your own test cases.

Test it Now
Next TopicJavaScript Math




Latest Courses