Computer >> Computer tutorials >  >> Programming >> Javascript

Math.cos() function in JavaScript


The cos() function of the Math object accepts an angle (in radians) and returns its cosine value.

Syntax

Its Syntax is as follows

Math.cos(90)

Example

<html>
<head>
   <title>JavaScript Example</title>
</head>
<body>
   <script type="text/javascript">
      var result = Math.cos(90);
      document.write("cosine value of the given angle: "+result);
   </script>
</body>
</html>

Output

cosine value of the given angle: -0.4480736161291702