Javascript Math.cos()方法
作者:--
发布时间:2019-11-20
评论:0
阅读:3
这个方法返回一个数字的余弦值。该余弦方法返回-1和1之间的数值,它表示角度的余弦值。
语法
math.cos( x ) ;
下面是参数的详细信息:
返回值:
返回一个数字的余弦值。
例子:
<html>
<head>
<title>javascript math cos() method</title>
</head>
<body>
<script type="text/javascript">
var value = math.cos(90);
document.write("first test value : " + value );
var value = math.cos(30);
document.write("<br />second test value : " + value );
var value = math.cos(-1);
document.write("<br />third test value : " + value );
var value = math.cos(2*math.pi);
document.write("<br />fourth test value : " + value );
</script>
</body>
</html>
这将产生以下结果:
first test value : -0.4480736161291701
second test value : 0.15425144988758405
third test value : 0.5403023058681398
fourth test value : 1