Parameters: This method accepts two parameters as mentioned above and described below:
- value1: This parameter represents the y-coordinate.
- value2: represents x-coordinate of the point (x,y).
Returns: It returns the arctangent of the quotient of its arguments.
Below are examples of the Math atan2() Method.
Example 1: When the y-coordinate is greater than the x-coordinate:
Example 2: When y-coordinate is smaller than x-coordinate
Input : Math.atan2(15, 90);
Output : 0.16514867741462683
Example 3: When y-coordinate is the same as x-coordinate
- Google Chrome 1 and above
- Firefox 1 and above
- Opera 3 and above
- Safari 1 and above