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