Skip to main content

Sequential Exec

MIDDLE

Sequential Exec

Execute an array of async functions sequentially (one after another).

Requirements:

  • Implement executeSequentially that takes array of async functions
  • Execute each function only after the previous one completes
  • Return an array of all results in order

Example:

const tasks = [
  async () => 1,
  async () => 2,
  async () => 3
];

executeSequentially(tasks).then(results => {
  console.log(results); // [1, 2, 3]
});

Examples:

Input 1:{"tasks":[null,null,null]}
Output 1:[1,2,3]

Loading editor...

Run your code to see results

Click the Run button above