Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created January 9, 2018 06:58
Embed
What would you like to do?
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