English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

JavaScript Math.atan2Method ()

 JavaScript Math Object

Math.atan2()Math.atan2The () method returns a value between-The numerical value between π and π, representing the angle θ(x, y) of the point.

This is the counterclockwise angle between the positive x-axis and the point (x, y) (in radians).

Note:The parameters of this function are passed first with the y-coordinate, then with the x-coordinate.

Because atan2() is a static method of Math, so you always use it asMath.atan2(), rather than used as a method of creating the Math object.

Syntax:

Math.atan2(y,  x)
Math.atan2(90, 15);
Test See‹/›

Browser Compatibility

All browsers fully support Math.atan2Method ():

Method
Math.atan2()IsIsIsIsIs

Parameter Value

ParameterDescription
yThe y-coordinate of the point
xThe x-coordinate of the point

Technical Details

Return Value:The arc angle between the positive x-axis and the ray from (0,0) to the point ([-π, π)
JavaScript Version:ECMAScript 1

 JavaScript Math Object