Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> JavaScript

ฟังก์ชัน Math.atanh() ใน JavaScript


ฟังก์ชัน atanh() ของออบเจ็กต์ Math จะรับตัวเลขและคืนค่า arctangent แบบไฮเปอร์โบลิกในหน่วยเรเดียน เพื่อแปลงค่าที่ได้เป็นองศา ให้คูณด้วย 180 แล้วหารด้วย 3.14159 (ค่า pi)

ไวยากรณ์

รูปแบบการใช้งานคือดังนี้

Math.atanh(0.5)

ตัวอย่าง

<html> <head>    <title>ตัวอย่าง JavaScript</title> </head> <body>    <script type="text/javascript">       var result = Math.atanh(0.5);       document.write("ค่า arctangent: "+result);       document.write("<br>");       document.write("ค่า arctangent แบบไฮเปอร์โบลิกในองศา: "+result*180/Math.PI);    </script> </body> </html>

ผลลัพธ์

ค่า arctangent: 0.5493061443340548 ค่า arctangent ในองศา: 31.47292373094538