JavaScript Math Object : cos()

The cos() method returns the cosine of a number, in radians. Syntax :
  Math.cos( number );
Example :
<script>
  var x = 12;
  var y = Math.cos(x);
  document.write("cos(12) : " + y + "<br/>");
  var x = 45;
  var y = Math.cos(x);
  document.write("cos(45) : " + y + "<br/>");
  var x = 0;
  var y = Math.cos(x);
  document.write("cos(0) : " + y + "<br/>");
</script>
Output :


Next Topic :