← All Exercises

Promise Chain Sequencer

intermediatejavascript~20min

Background

Sequential promise execution is needed when API calls depend on previous results or when rate limits prevent parallel execution.

Problem

Write a function that takes an array of promise-returning functions and executes them sequentially, passing each result to the next function.

Input

An array of functions, each returning a Promise.

Output

A Promise that resolves with the final result after all functions complete sequentially.

Sample tests

Sample 1

Input: [fn1, fn2, fn3]
Expected: result of fn3(fn2(fn1()))

Your solution

Learning objective

Learn sequential promise chaining using reduce and understand promise composition.