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

การใช้งาน Math.asinh() และ Math.acosh() ใน JavaScript

ฟังก์ชัน Math.asinh() และ Math.acosh() ใช้หา Hyperbolic Arc-sine และ Hyperbolic Arc-cosine ของตัวเลขตามลำดับ ฟังก์ชันเหล่านี้เป็น Static Methods ของ Math จึงใช้เป็น Math.asinh() และ Math.acosh() เสมอ ไม่ใช่เมธอดของ Math Object ที่สร้างขึ้น

Math.asinh()

เมธอดนี้ใช้หา Hyperbolic Arc-sine ของตัวเลข รับพารามิเตอร์เป็นตัวเลข และคืนค่า Hyperbolic Sine Value

ตัวอย่าง

<html> <body> <script> document.write(Math.asinh(2)); document.write("</br>"); document.write(Math.asinh(7)); </script> </body> </html>

ผลลัพธ์

1.4436354751788103 2.644120761058629

Math.acosh()

เมธอดนี้ใช้หา Hyperbolic Arc-cosine ของตัวเลข รับพารามิเตอร์เป็นตัวเลข และคืนค่า Hyperbolic Cosine Value

ตัวอย่าง

<html> <body> <script> document.write(Math.acosh(2)); document.write("</br>"); document.write(Math.acosh(7)); </script> </body> </html>

ผลลัพธ์

1.3169578969248166 2.6339157938496336