Skip to content

Instantly share code, notes, and snippets.

@Alxandr
Created December 10, 2014 01:16
Show Gist options
  • Select an option

  • Save Alxandr/90e8626b810df85eb553 to your computer and use it in GitHub Desktop.

Select an option

Save Alxandr/90e8626b810df85eb553 to your computer and use it in GitHub Desktop.
Async js loop
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