English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
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.
Math.atan2(y, x)
Math.atan2(90, 15);Test See‹/›
All browsers fully support Math.atan2Method ():
Method | |||||
Math.atan2() | Is | Is | Is | Is | Is |
Parameter | Description |
---|---|
y | The y-coordinate of the point |
x | The x-coordinate of the point |
Return Value: | The arc angle between the positive x-axis and the ray from (0,0) to the point ([-π, π) |
---|---|
JavaScript Version: | ECMAScript 1 |