Explorer
Node.js

Write a function `fastest(promises)` that returns a promise resolving/rejecting with the first settled promise.

Problem Statement

Write a function `fastest(promises)` that returns a promise resolving/rejecting with the first settled promise.

Complexity

Time Complexity: -

Space Complexity: -

Hints

šŸ’” Hint 1: Promise.race() resolves or rejects as soon as any promise settles first. šŸ’” Hint 2: The "winner" determines whether race resolves or rejects. šŸ’” Hint 3: return Promise.race(promises); āœ… Solution: ```javascript function fastest(promises) { return Promise.race(promises); } ```

Promise.race

Medium
Write a function `fastest(promises)` that returns a promise resolving/rejecting with the first settled promise.
Editor
Loading Editor...
Evaluate code
Output:Click "Run" above to execute and verify your code here.
"first"