JavaScript中的acos()方法使用详解
此方法返回的弧度的反余弦值。ACOS方法返回0和PI对于x-1和1之间弧度的数值。如果数的值超出这个范围,则返回NaN。
语法
Math.acos(x);
下面是参数的详细信息:
- x:一个数字
返回值:
- 返回了一些弧度的反余弦值。
例子:
<html>
<head>
<title>JavaScriptMathacos()Method</title>
</head>
<body>
<scripttype="text/javascript">
varvalue=Math.acos(-1);
document.write("FirstTestValue:"+value);
varvalue=Math.acos(null);
document.write("<br/>SecondTestValue:"+value);
varvalue=Math.acos(30);
document.write("<br/>ThirdTestValue:"+value);
varvalue=Math.acos("string");
document.write("<br/>FourthTestValue:"+value);
</script>
</body>
</html>
这将产生以下结果:
FirstTestValue:3.141592653589793 SecondTestValue:1.5707963267948965 ThirdTestValue:NaN FourthTestValue:NaN
热门推荐
10 老师祝您订婚祝福语简短
11 四十不惑祝福语简短
12 室友生宝宝祝福语简短
13 古诗辞职祝福语大全简短
14 行公司生日祝福语简短
15 给军属的祝福语简短
16 车位销售祝福语简短精辟
17 男子成婚诗词祝福语简短
18 工作离别祝福语 英语简短