JavaScript 中的 Math.log() 函数

htmljavascriptweb developmentfront end technology更新于 2024/8/11 20:42:00

Math 对象的 log() 函数接受一个数字并返回给定数字的自然对数(底数为 e)。

语法

其语法如下

Math.log(48);

示例

<html>
<head>
   <title>JavaScript 示例</title>
</head>
<body>
   <script type="text/javascript">
      var result = Math.log(48);
      document.write("结果: "+result);
   </script>
</body>
</html>

输出

结果: 3.8712010109078907

相关文章