Async/Await and Promises
Great example of async await functions working together with a promise.
JavaScript
async function f() {
let promise = new Promise((resolve, reject) => {
setTimeout(() => resolve("done!"), 5000)
});
let result = await promise; // wait until the promise resolves (*)
alert(result); // "done!"
}
f();