Skip to content

Instantly share code, notes, and snippets.

@sreepurnajasti
Created June 28, 2018 08:53
Show Gist options
  • Save sreepurnajasti/4c2e7fa58469aaa0b615b67d8348fa95 to your computer and use it in GitHub Desktop.
Save sreepurnajasti/4c2e7fa58469aaa0b615b67d8348fa95 to your computer and use it in GitHub Desktop.
use of async await functionality
function resolveAfter2Seconds(x) {
return new Promise(resolve => {
//resolve(x)
});
}
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