
await Keyword – `await` pauses async function execution until the promise resolves, then returns its result.
๐ Syntax
const result = await promise;
๐งช Example
async function main() {
const user = await fetch('/user').then(r => r.json());
console.log(user);
}
Comments
Post a Comment