mirror of
https://github.com/ruanyf/es6tutorial.git
synced 2025-05-24 18:32:22 +00:00
docs(proposals): edit BigInt
This commit is contained in:
parent
99b39cc230
commit
eebbf77f99
@ -691,7 +691,7 @@ p
|
||||
|
||||
## Promise.allSettled()
|
||||
|
||||
`Promise.allSettled()`方法接受一组 Promise 实例作为参数,包装成一个新的 Promise 实例。只有等到所有这些参数实例都返回结果,不管是`fulfilled`还是`rejected`,包装实例才会结束。该方法由[ES2020](https://github.com/tc39/proposal-promise-allSettled) 引入。
|
||||
`Promise.allSettled()`方法接受一组 Promise 实例作为参数,包装成一个新的 Promise 实例。只有等到所有这些参数实例都返回结果,不管是`fulfilled`还是`rejected`,包装实例才会结束。该方法由 [ES2020](https://github.com/tc39/proposal-promise-allSettled) 引入。
|
||||
|
||||
```javascript
|
||||
const promises = [
|
||||
|
@ -694,12 +694,15 @@ BigInt(1.5) // RangeError
|
||||
BigInt('1.5') // SyntaxError
|
||||
```
|
||||
|
||||
BigInt 对象继承了 Object 提供的实例方法。
|
||||
BigInt 对象继承了 Object 对象的两个实例方法。
|
||||
|
||||
- `BigInt.prototype.toLocaleString()`
|
||||
- `BigInt.prototype.toString()`
|
||||
- `BigInt.prototype.valueOf()`
|
||||
|
||||
它还继承了 Number 对象的一个实例方法。
|
||||
|
||||
- `BigInt.prototype.toLocaleString()`
|
||||
|
||||
此外,还提供了三个静态方法。
|
||||
|
||||
- `BigInt.asUintN(width, BigInt)`: 给定的 BigInt 转为 0 到 2<sup>width</sup> - 1 之间对应的值。
|
||||
|
Loading…
x
Reference in New Issue
Block a user