JavaScript Math.log 方法
Math.log 方法用于取得 e 的指数值。语法如下:
Math.log(x)
参数 | 说明 |
---|---|
x | 必需。大于 0 的数值。 |
Math.log 方法实例
<script language="JavaScript"> document.write( Math.log(Math.E) + "<br />" ); document.write(Math.log(10) + "<br />") document.write( Math.log(1) + "<br />" ); document.write( Math.log(-1) ); </script>
运行该例子,输出:
1 2.302585092994046 0 NaN
本章节内容共分 19 部分:
- JavaScript 数学计算(Math 对象)
- JavaScript Math.abs 方法:得到数字的绝对值
- JavaScript Math.acos 方法:得到数值的反余弦值
- JavaScript Math.asin 方法:得到数值的反正弦值
- JavaScript Math.atan 方法:得到数值的反正切值
- JavaScript Math.atan2(y,x) 方法:得到从 x 轴到点 (x,y) 之间的角度
- JavaScript Math.ceil 方法:对数值向上取整
- JavaScript Math.cos 方法:得到数值的余弦值
- JavaScript Math.exp(x) 方法:得到 e 的 x 次幂
- JavaScript Math.floor 方法:对数值向下取整
- JavaScript Math.log 方法:得到数的自然对数值(底为e)
- JavaScript Math.max 方法:得到多个数中的最大数
- JavaScript Math.min 方法:得到多个数中的最小数
- JavaScript Math.pow(x,y) 方法:得到 x 的 y 次幂的值
- JavaScript Math.random 方法:得到 0 ~ 1 之间的一个随机数
- JavaScript Math.round 方法:按照四舍五入的规则取整
- JavaScript Math.sin 方法:得到一个数字的正弦值
- JavaScript Math.sqrt 方法:得到一个数字的平方根
- JavaScript Math.tan 方法:得到一个数字的正切值