Recall & Review
beginner
What is promise chaining in JavaScript?
Promise chaining is a way to run multiple asynchronous tasks one after another, where each task starts when the previous one finishes, using
.then() methods.Click to reveal answer
beginner
How do you return a value from one promise to the next in a chain?
You return the value inside the
.then() callback. This value becomes the input for the next .then() in the chain.Click to reveal answer
intermediate
What happens if you return a new promise inside a
.then() callback?The next
.then() waits for that new promise to resolve before running, allowing you to chain asynchronous operations smoothly.Click to reveal answer
beginner
How do you handle errors in a promise chain?
You can add a
.catch() at the end of the chain to catch any error from any promise in the chain.Click to reveal answer
beginner
What is the benefit of promise chaining over nested callbacks?
Promise chaining avoids deeply nested code (callback hell), making asynchronous code easier to read and maintain.
Click to reveal answer
What does
promise.then() return?✗ Incorrect
then() always returns a new promise that resolves with the value returned inside its callback.How can you pass data from one promise to the next in a chain?
✗ Incorrect
Returning data inside
.then() passes it to the next .then() callback.What happens if a promise in the chain rejects and there is no
.catch()?✗ Incorrect
Without
.catch(), a rejection causes an unhandled promise rejection error and stops the chain.Which of these is a correct way to chain promises?
✗ Incorrect
Returning a promise inside
.then() correctly chains the promises.Why is promise chaining preferred over nested callbacks?
✗ Incorrect
Promise chaining avoids nested code, making asynchronous flows clearer and easier to maintain.
Explain how promise chaining works and why it is useful.
Think about how you can do one task after another without nesting functions.
You got /5 concepts.
Describe how errors are handled in a promise chain.
Consider what happens if something goes wrong in any step.
You got /4 concepts.