Math.atan2

atan2 — Returns the arc-tangent of the quotient of x and y.

Description

Math.atan2(number x, number y)

Parameters

Name Description Type Default Optional
x number No
y number No

Examples

Example #1 – atan2 example
console.log(Math.atan2(0, 0)); // 0 console.log(Math.atan2(0, -0)); // 3.141592653589793 console.log(Math.atan2(-0, 0)); // -0 console.log(Math.atan2(40, 4)); // 1.4711276743037347

External references