JavaScript中的Math.cos()函数

cos()Math对象的功能接受一个角度(以弧度为单位)并返回其余弦值。

语法

它的语法如下

Math.cos(90)

示例

<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>

输出结果

cosine value of the given angle: -0.4480736161291702