Explorer
Node.js

Write a function `fetchAll(promises)` that takes an array of promises and returns a promise that resolves with all results.

Problem Statement

Write a function `fetchAll(promises)` that takes an array of promises and returns a promise that resolves with all results.

Complexity

Time Complexity: -

Space Complexity: -

Hints

šŸ’” Hint 1: Promise.all() takes an array of promises and resolves when all resolve. šŸ’” Hint 2: If any promise rejects, Promise.all rejects immediately. šŸ’” Hint 3: return Promise.all(promises); āœ… Solution: ```javascript function fetchAll(promises) { return Promise.all(promises); } ```

Promise.all

Medium
Write a function `fetchAll(promises)` that takes an array of promises and returns a promise that resolves with all results.
Editor
Loading Editor...
Evaluate code
Output:Click "Run" above to execute and verify your code here.
[1,2,3]