Created
January 24, 2019 23:57
-
-
Save icehongssii/3e596cd7066694f7c323c5a9b96c51d1 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 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