Lesson 16 — Promise chaining
One step after another
Each .then returns a new Promise holding whatever its callback returned. That means you can chain steps: the next .then receives the previous result. If any step throws, a .catch at the end handles it.
Promise.resolve("ann")
.then((s) => s.toUpperCase())
.then((s) => console.log(s)); // ANN
Why it matters: fetch code is usually a chain — get the response, read the JSON, use the data — so you must know how values flow down it.
Add one more step to the chain so it prints 11 (5 doubled, plus 1).
Run your code — when the output matches the task, you will see a green check. Then mark the lesson complete.
A quick 3-question quiz on this lesson — instant feedback.
Ready for more? Optional paid resources that pick up where this lesson leaves off.
Some links on this page are affiliate links: we may earn a commission at no extra cost to you. As an Amazon Associate I earn from qualifying purchases.
Project-based JavaScript Intermediate courses if you want a structured paid path after the free lessons. Wait for a sale — prices drop often.
Browse on Udemy →Search Amazon for JavaScript Intermediate books — check the publication year so the examples match current versions.
Search Amazon →