JavaScript Math Object : atan2(y, x)

The atan2() method returns the arctangent of the quotient of its arguments. It returns a numeric value between -pi and pi representing the angle theta of an (x, y) point. Syntax :
  Math.atan2( num1, num2 );
Example :
<script>
  var value = Math.atan2(12, 20);
  document.write("atan2(12, 20) : " + value+ "<br/>");
  var value = Math.atan2(45, 32);
  document.write("atan2(45, 32) : " + value+ "<br/>");
  var value = Math.atan2(-0, 0);
  document.write("atan2(-0, -0) : " + value+ "<br/>");
</script>
Output :


Next Topic :