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