Created
January 9, 2018 06:58
-
-
Save goofmint/67183c173706645c15add48bf5f3c9b4 to your computer and use it in GitHub Desktop.
This file contains 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
function delay(x) { | |
return new Promise(res => { | |
setTimeout(() => { | |
res(x); | |
}, 2000); | |
}); | |
} | |
async function main() { | |
var x = await delay(10); | |
console.log(x); | |
var y = await delay(20); | |
console.log(y); | |
} | |
main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment