Skip to content

Instantly share code, notes, and snippets.

@jautero
Created May 11, 2017 15:45
Show Gist options
  • Save jautero/399b57bee29dad89b1783f954a2fc7f0 to your computer and use it in GitHub Desktop.
Save jautero/399b57bee29dad89b1783f954a2fc7f0 to your computer and use it in GitHub Desktop.
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