Delay Function

Delay Function
쉬움 비동기 +10pts

Problem

Write a function that returns a promise that resolves after a specified delay.

Examples

Input: await delay(1000)
Output: undefined (1초 후)

Explanation

이 문제는 **Promise**와 **setTimeout**을 결합하여 비동기 지연을 구현하는 방법을 학습합니다. **Promise란?** 비동기 작업의 완료(또는 실패)를 나타내는 객체입니다. pending, fulfilled, rejected 세 가지 상태가 있습니다. **Promise 생성자** `new Promise((resolve, reject) => { ... })` - resolve: 성공 시 호출 - reject: 실패 시 호출 **setTimeout과 Promise 연결** ```javascript new Pr...

View detailed explanation →

Key Concepts

Promise 생성 setTimeout resolve 함수 비동기 지연
Time: O(1) Space: O(1)
solution.js
Ctrl + Enter
Run tests to see results here.