Skip to content

Instantly share code, notes, and snippets.

@icehongssii
Created January 24, 2019 23:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save icehongssii/3e596cd7066694f7c323c5a9b96c51d1 to your computer and use it in GitHub Desktop.
Save icehongssii/3e596cd7066694f7c323c5a9b96c51d1 to your computer and use it in GitHub Desktop.
async function f() {
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), 1000)
});
let result = await promise; // wait till the promise resolves (*)
alert(result); // "done!"
}
f();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment