Math atan2() Method

Math atan2() method is used to return the arctangent of the quotient of its argumnets. The atan2 method returns the numeric value between –pi/2 and pi/2 radians representing the angle theta of an (x, y) point.

If you had a point with the (x,y) coordinates of (3,9), you should calculate the angle in radians between that point and the positive X axis.

Syntax:
Math.atan2(x, y)

Example:
<script>
var one = Math.atan2(6, 9);
document.writeln('Angle of radians 6, 9 : ' + one + '</br></br>');
var two = Math.atan(30,90);
document.writeln('Angle of radians 30, 90 : ' + two + '</br></br>');
</script>

Output:
Angle of radians 6, 9 : 0.5880026035475675
Angle of radians 30, 90 : 1.5374753309166493
Copyright Labw3