Created
November 30, 2017 11:40
-
-
Save jose-marin/0b66972650798f8afe153da5bcd0a792 to your computer and use it in GitHub Desktop.
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 = [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