Skip to content

Instantly share code, notes, and snippets.

@onlurking
Created February 15, 2018 03:03
Show Gist options
  • Save onlurking/980f7ecb10e756e1bcd644c5b9fd6389 to your computer and use it in GitHub Desktop.
Save onlurking/980f7ecb10e756e1bcd644c5b9fd6389 to your computer and use it in GitHub Desktop.
async function add3(x) {
return new Promise(resolve => {
setTimeout(() => {
resolve(x + 3);
}, 2000);
});
}
async function t3() {
let x;
return new Promise(resolve => {
setTimeout(() => {
x = 24;
resolve(x);
}, 2000);
});
}
async function print(){
var k = await t3();
var l = await add3(k)
console.log(l);
}
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment