All academies
All challenges

A Typed Delay Function

easyasync50 XP

Problem

Write delay(ms: number): Promise<void> that resolves after the given number of milliseconds, using setTimeout wrapped in a Promise. Then, in an async main function, log "start", await a 100ms delay, and log "done". The logs must appear in that exact order.

Expected output

start
done

Hints

Stuck? Reveal hints one at a time.

Solution

Try solving it yourself first — revealing is always available.

Press Run in the editor — your console output is checked automatically.
No errors
Loading...

Console output appears here. Press Run or just type — the code compiles automatically.