Practice
JavaScriptData StructuresReactConcepts
Sign in
← Back to problems

Async Step Pipeline

Asynchronous JavaScripthard

Course · Section 16: Asynchronous JavaScript: Promises, Async/Await, and AJAX · Lecture 263: Promises and the Fetch API

Implement an async function `pipelineAsync(value, steps)` that awaits each named step applied to `value` in order. Steps are `inc` (add 1) or `double` (multiply by 2).

Sample tests

Input: pipelineAsync(3, ["inc","double"])
Output: 8
Input: pipelineAsync(5, [])
Output: 5

+ 1 hidden test run on Submit.

Hints

Common pitfalls
  • Not awaiting inside the loop, mixing pending promises into the value.

Learning resources

  • MDN: async function
Approach & explanation (try first)

Awaiting each named step in order builds an async pipeline over the starting value.

Loading...
⌘/Ctrl + Enter

Run your code to see results.