We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf3d165 commit 2bd0cbbCopy full SHA for 2bd0cbb
docs/number.md
@@ -68,7 +68,22 @@ Number.isSafeInteger(outside) // false
68
69
## Math对象的扩展
70
71
-ES6在Math对象上提供了更多的数学方法。
+**(1)Math.trunc()**
72
+
73
+Math.trunc方法用于去除一个数的小数部分,返回整数部分。
74
75
+```javascript
76
77
+Math.trunc(4.1) // 4
78
+Math.trunc(4.9) // 4
79
+Math.trunc(-4.1) // -4
80
+Math.trunc(-4.9) // -4
81
82
+```
83
84
+**(2)数学方法**
85
86
+ES6在Math对象上还提供了许多新的数学方法。
87
88
- Math.acosh(x) 返回x的反双曲余弦(inverse hyperbolic cosine)
89
- Math.asinh(x) 返回x的反双曲正弦(inverse hyperbolic sine)
@@ -85,4 +100,3 @@ ES6在Math对象上提供了更多的数学方法。
100
- Math.log2(x) 返回以2为底的x的对数
101
- Math.sign(x) 如果x为负返回-1,x为0返回0,x为正返回1
102
- Math.tanh(x) 返回x的双曲正切(hyperbolic tangent)
-- Math.trunc(x) 移除一个浮点数的小数位,返回一个整数
0 commit comments