Search⌘ K
AI Features

Return Values in Promise Chains

Explore how to pass values through JavaScript promise chains by returning data from fulfillment and rejection handlers. Understand how finally differs by ignoring returned values to preserve the original promise outcome. This lesson helps you manage sequential asynchronous operations with effective data flow.

Returning values in promise chains

Another important aspect of promise chains is their ability to pass data from one promise to the next. We have already seen that a value passed to the resolve() handler inside an executor is passed to the fulfillment handler for that promise. We can continue passing data along a chain by specifying a return value from the fulfillment handler.

Let’s look at the illustration below to see how ...