Promises and Combinators
Learn Promises and Combinators (Phase 8 · Promises, async/await, Event Loop (Essential), JavaScript) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
A promise is a value that arrives later • A Promise is in one of three states: pending , fulfilled (with a value) or rejected (with a reason). Once settled it never changes. • Consume with .then(onFulfilled) , .catch(onRejected) , .finally(cleanup) . Each returns a new promise, enabling chaining . • Create with new Promise((resolve, reject) => {...}) , or Promise.resolve(x) / Promise.reject(err) .