Promises and Async/Await
A Promise represents a future value. async/await lets you write async code that reads like sync code.
- await pauses an async function until the Promise settles.
- Always handle rejection with try/catch or .catch.
- Promise.all runs independent work in parallel.
async function main() {
const value = await Promise.resolve("ready");
console.log(value);
}
main();
After you read this chapter, use Write (when available) and Quiz on this page to lock it in.