File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
1-js/11-async/05-promise-api Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -230,7 +230,7 @@ let promise = Promise.any(iterable);
230230For instance, here the result will be `1`:
231231
232232```js run
233- Promise.race ([
233+ Promise.any ([
234234 new Promise((resolve, reject) => setTimeout(() => reject(new Error("Whoops!")), 1000)),
235235 new Promise((resolve, reject) => setTimeout(() => resolve(1), 2000)),
236236 new Promise((resolve, reject) => setTimeout(() => resolve(3), 3000))
@@ -302,7 +302,8 @@ There are 5 static methods of `Promise` class:
302302 - `status`: `"fulfilled"` or `"rejected"`
303303 - `value` (if fulfilled) or `reason` (if rejected).
3043043. `Promise.race(promises)` -- waits for the first promise to settle, and its result/error becomes the outcome.
305- 4. `Promise.resolve(value)` -- makes a resolved promise with the given value.
306- 5. `Promise.reject(error)` -- makes a rejected promise with the given error.
305+ 4. `Promise.any(promises)` -- waits for the first promise to fulfill, and its result/error becomes the outcome.
306+ 5. `Promise.resolve(value)` -- makes a resolved promise with the given value.
307+ 6. `Promise.reject(error)` -- makes a rejected promise with the given error.
307308
308309Of these five, `Promise.all` is probably the most common in practice.
You can’t perform that action at this time.
0 commit comments