JavaScript 中的 Math.asin() 函数
htmljavascriptweb developmentfront end technology
Math 对象的 asin() 函数接受一个数字并以弧度返回其反正弦值。要将结果值转换为度数,请将其乘以 180,然后将结果除以 3.14159(pi 值)。
语法
其语法如下
Math.asin(0.5)
示例
<html> <head> <title>JavaScript 示例</title> </head> <body> <script type="text/javascript"> var result = Math.asin(0.5); document.write("反正弦值:"+result); document.write("<br>"); document.write("反正弦值(度):"+result*180/Math.PI); </script> </body> </html>
输出
反正弦值:0.5235987755982989 反正弦值(度):30.000000000000004