JavaScript Math.atan2() Method

You are Here:

JavaScript Math.atan2() Method

The Math.atan2() method returns the angle in the plane between the positive x-axis and the ray from (0, 0) to the point (x, y), for Math.atan2(y, x).

Example

HTML Online Editor
<!DOCTYPE html> <html> <body> <script> var result = Math.atan2(4, 2); document.write(result); </script> </body> </html>

Syntax

Math.atan2(y, x)

Parameter Values

ValueTypeExplanation
yRequiredThe y coordinate of the point.
xRequiredThe x coordinate of the point.

Return Value

ValueExplanation
NumberThe arc-tangent of the quotient of its arguments.
The return value will be between -π and π.
The return value is represented in radians.
NaNIf the given value is empty.

Reminder

Hi Developers, we almost covered 97% of JavaScript Tutorials with examples for quick and easy learning.

We are working to cover every Single Concept in JavaScript.

Please do google search for:

Join Our Channel

Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.

This channel is primarily useful for Full Stack Web Developer.

Share this Page

Meet the Author