ฟังก์ชัน asin() ของอ็อบเจกต์ Math ยอมรับตัวเลขและส่งกลับค่า arc sin ในหน่วยเรเดียน หากต้องการแปลงค่าผลลัพธ์เป็นองศา ให้คูณด้วย 180 แล้วหารผลลัพธ์ด้วย 3.14159 (ค่า pi)
ไวยากรณ์
ไวยากรณ์ของมันคือดังต่อไปนี้
Math.asin(0.5)
ตัวอย่าง
<html>
<head>
<title>JavaScript Example</title>
</head>
<body>
<script type="text/javascript">
var result = Math.asin(0.5);
document.write("arcsine value: "+result);
document.write("<br>");
document.write("arcsine value in degrees: "+result*180/Math.PI);
</script>
</body>
</html> ผลลัพธ์
arcsine value: 0.5235987755982989 arcsine value in degrees: 30.000000000000004