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