Module 7 · Lesson 1 of 425/32 in the course~18 min
Module lessons (1/4)
Promises: what they are
Lesson preview5 hands-on exercises readyJavaScript Course · Module 7 — Asynchronous
pending/fulfilled/rejected state, .then/.catch, Promise.resolve and reject.
What you'll learn in this lesson
- Understand the three states of a
Promise(pending,fulfilled,rejected) and its immutability after resolution. - Create and consume Promise with
Promise.resolve,Promise.reject,.then,.catch, and.finally. - Understand why Promises feed the Microtask Queue, executed before any
setTimeout(Macrotask). - Chain
.then(...)transformations while handling failures with a final.catch(...).
Overview
A Promise is a container for a future value produced by an asynchronous operation. As soon as a Promise changes from the state pending to fulfilled or rejected, its state and value remain fixed forever.
Sections covered in this lesson
- 1Mental model: life cycle and tails of the Event Loop
- 2Progressive examples
- 3Guided laboratory
- 4Check for understanding
Pro Lesson · Module 7 — Asynchronous
Unlock "Promises: what they are" and the full JavaScript Course curriculum
pending/fulfilled/rejected state, .then/.catch, Promise.resolve and reject.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in JavaScript Course plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.