Lesson content
Read, practise, then check your understanding
A Promise is pending then permanently fulfilled or rejected. then returns a new Promise and adopts returned values/Promises; thrown errors become rejections.
Composition
fetchProfile(id)
.then(profile => fetchPermissions(profile.id))
.then(render)
.catch(reportError)
.finally(hideSpinner);
Return nested Promises so chains remain flat. Promise.all is fail-fast, allSettled reports every outcome, race settles first, and any fulfills first. Promise construction executes synchronously; reactions run as microtasks. A Promise alone does not cancel underlying work—pair APIs with AbortSignal or another explicit cancellation contract.
Knowledge check
Answer every question correctly to complete this chapter.
0 of 10 checks passed
Your progress is saved on this device.