Created
May 11, 2017 15:45
-
-
Save jautero/399b57bee29dad89b1783f954a2fc7f0 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 resolveAfter2Seconds(x) { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(x); | |
}, 2000); | |
}); | |
} | |
async function f1() { | |
var x = await resolveAfter2Seconds(10); | |
console.log(x); // 10 | |
} | |
f1(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment