Created
December 10, 2014 01:16
-
-
Save Alxandr/90e8626b810df85eb553 to your computer and use it in GitHub Desktop.
Async js loop
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
| async function foo() { | |
| try { | |
| let result = []; | |
| for (let value of await getValues()) { | |
| let newVal = await asyncOperation(value); | |
| console.log(newVal); | |
| result.push(newVal); | |
| } | |
| return result; | |
| } catch (e) { | |
| console.log('Err'); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment