Skip to content

Instantly share code, notes, and snippets.

@schahriar
Created January 14, 2018 22:17
Show Gist options
  • Save schahriar/c106e6043ddf2bd9d77cbeebd7a31697 to your computer and use it in GitHub Desktop.
Save schahriar/c106e6043ddf2bd9d77cbeebd7a31697 to your computer and use it in GitHub Desktop.
Delayed loop #async-await #medium
const randForTen = async () => {
let results = [];
for (let i = 0; i < 10; i++) {
await timeoutPromise(1000);
results.push(Math.random());
}
return results;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment