Skip to content

Instantly share code, notes, and snippets.

@jose-marin
Created November 30, 2017 11:40
Show Gist options
  • Save jose-marin/0b66972650798f8afe153da5bcd0a792 to your computer and use it in GitHub Desktop.
Save jose-marin/0b66972650798f8afe153da5bcd0a792 to your computer and use it in GitHub Desktop.
const x = [1, 2, 3];
function delay() {
return new Promise(resolve => setTimeout(resolve, 1000));
}
async function delayLog(item) {
await delay();
console.log(item);
}
async function logArray(array) {
for(const i of array) {
await delayLog(i);
}
await delayLog("Done");
}
logArray(x);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment