# JavaScript atan2

The JavaScript atan2 function is one of the Math functions used to return the angle (in radius) from the X-Axiss to the specified point (y, x). The basic syntax of the atan2 Function is as shown below:

`Math.atan2(y, x);`

X: represent Cartesian X – Coordinate and Y represent Cartesian Y – Coordinate. If anyone of the argument is a Null Value, it will convert the Null value to Zero. If any argument is not a number, it will return NaN.

## JavaScript atan2 Function Example

In this atan2 example, we find the angle (in radius) with different data types and display the output. Please refer to TAN in JavaScript to understand the Tangent function.

```<!DOCTYPE html>
<html>
<title> JavaScriptATAN2Function </title>
<body>
<h1> JavaScriptATAN2Function </h1>
<p id = "Pos"></p>
<p id = "Neg"></p>
<p id = "Dec"></p>
<p id = "Neg_Dec"></p>
<p id = "Str"></p>
<p id = "Str1"></p>
<p id = "Null"></p>
<p id = "Multi"></p>
<script>
document.getElementById("Pos").innerHTML = Math.atan2(2, 4);
document.getElementById("Neg").innerHTML = Math.atan2(-1, 6);
document.getElementById("Dec").innerHTML = Math.atan2(2.45, 0.45);
document.getElementById("Neg_Dec").innerHTML = Math.atan2(-4.75, -0.75);
document.getElementById("Str").innerHTML = Math.atan2("5", "11");
document.getElementById("Str1").innerHTML = Math.atan2("Js", "JavaScript");
document.getElementById("Null").innerHTML = Math.atan2(null, 4);
document.getElementById("Multi").innerHTML = Math.atan2(2 + 7 - 4, 9-5);
</script>
</body>
</html>```