Created
March 22, 2019 14:09
-
-
Save yatki/fe561fd8f88ef63334d6f9838e9c12fa to your computer and use it in GitHub Desktop.
for await of example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const x = [ | |
| new Promise(resolve => setTimeout(() => resolve('500'), 500)), | |
| new Promise(resolve => setTimeout(() => resolve('600'), 600)), | |
| new Promise(resolve => setTimeout(() => resolve('100'), 100)), | |
| ] | |
| for await (let o of x) { | |
| console.log(o); | |
| } | |
| /** | |
| * Output: | |
| 500 | |
| 600 | |
| 100 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment