Promise Race

Promise Race
보통 비동기 +20pts

Problem

Implement a simplified version of Promise.race.

Examples

Input: promiseRace([delay(100), delay(50)])
Output: 먼저 완료되는 Promise 결과

Explanation

이 문제는 **Promise.race**의 동작 원리를 이해하고 직접 구현하는 방법을 학습합니다. ## 핵심 개념: Promise.race 가장 먼저 완료되는 Promise의 결과를 반환합니다. ### 동작 방식 1. 가장 먼저 성공한 Promise → resolve 2. 가장 먼저 실패한 Promise → reject 3. 첫 번째 결과만 사용 (나머지는 무시) ### 구현 분석 ```javascript return new Promise((resolve, reject) => { promises.forEach(p => {...

View detailed explanation →

Key Concepts

Promise.race 경쟁 조건 첫 번째 완료 타임아웃 패턴
Time: O(n) Space: O(1)
solution.js
Ctrl + Enter
Run tests to see results here.