Created
February 15, 2018 03:03
-
-
Save onlurking/980f7ecb10e756e1bcd644c5b9fd6389 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
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