/

HTML / CSS / JavaScript Tutorial

JavaScript Math method: atan2()

[this page | pdf | back links]

The atan2() method (of the Math object) returns the (principal) arctangent of a real number.

 

It has the following syntax with the following parameters:

 

Math.atan2(y,x)

 

Parameter

Required / Optional

Description

y

Required

y-coordinate

x

Required

x-coordinate

 

Note: many computer languages have an atan2 function, but the ordering of the parameters is not the same across all languages

 


NAVIGATION LINKS
Contents | Prev | Next | JavaScript Numbers and Math


Desktop view | Switch to Mobile