JavaScript · Numbers and Math

Math.atan2()

Returns the angle of a vector, handling all quadrants.

Syntax
Math.atan2(y, x)

Example

Try it

More in this group

BigInt BigInt.asIntN() BigInt.asUintN() Exponentiation Math.abs() Math.cbrt() Math.exp() Math.floor() / ceil()

Learn this in the course

Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.

Open the course