The atan2() method returns the arctangent of the quotient of its arguments, between PI and -PI radians.

The atan2() method returns the arctangent of the quotient of its arguments, between PI and -PI radians.

With atan2(), the y coordinate is passed as the first argument and the x coordinate is passed as the second argument.

Math.atan2(y, x)

Parameter | Require | Description |
---|---|---|

y | Required. | A number representing the y coordinate |

x | Required. | A number representing the x coordinate |

A Number, from PI to -PI, or NaN if the value(s) are empty

//display the arctangent of 8/4 console.log(Math.atan2(8, 4));