ฟังก์ชัน sin() ของออบเจ็กต์ Math จะรับมุม (ในหน่วยเรเดียน) และคืนค่า sine ของมุมนั้น
ไวยากรณ์
รูปแบบการใช้งานคือดังนี้
Math.sin(90)
ตัวอย่าง
<html> <head> <title>ตัวอย่าง JavaScript</title> </head> <body> <script type="text/javascript"> var result = Math.sin(90); document.write("ค่า sine ของมุมที่ให้มา: "+result); </script> </body> </html>ผลลัพธ์
ค่า sine ของมุมที่ให้มา: 0.8939966636005579