JavaScript Math Object : atan()

The atan() method returns the arctangent of a numeric value, in radians. It returns a numeric value between -pi/2 and pi/2 radians for given number. Syntax :
  Math.atan( number );
Example :
<script>
  var x = -1;
  var y = Math.atan(x);
  document.write("atan(-1) : " + y + "<br/>");
  var x = 5;
  var y = Math.atan(x);
  document.write("atan(5) : " + y + "<br/>");
  var x = -20;
  var y = Math.atan(x);
  document.write("atan(-20) : " + y + "<br/>");
  var x = 35;
  var y = Math.atan(x);
  document.write("atan(35) : " + y + "<br/>");
</script> 
Output :


Next Topic :