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