mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2024-04-21 12:32:22 +00:00
docs(math): fix #973
This commit is contained in:
+3
-3
@@ -397,16 +397,16 @@ Math.sign = Math.sign || function(x) {
|
||||
|
||||
### Math.cbrt()
|
||||
|
||||
`Math.cbrt`方法用于计算一个数的立方根。
|
||||
`Math.cbrt()`方法用于计算一个数的立方根。
|
||||
|
||||
```javascript
|
||||
Math.cbrt(-1) // -1
|
||||
Math.cbrt(0) // 0
|
||||
Math.cbrt(1) // 1
|
||||
Math.cbrt(2) // 1.2599210498948734
|
||||
Math.cbrt(2) // 1.2599210498948732
|
||||
```
|
||||
|
||||
对于非数值,`Math.cbrt`方法内部也是先使用`Number`方法将其转为数值。
|
||||
对于非数值,`Math.cbrt()`方法内部也是先使用`Number()`方法将其转为数值。
|
||||
|
||||
```javascript
|
||||
Math.cbrt('8') // 2
|
||||
|
||||
Reference in New Issue
Block a user