freecoding.school100% FREE · NO SIGNUP
Await StationISSUE #3 of 26

promises · pending · fulfilled · rejected

PromissaVSRace Condition Rex
Promissa saysA promise represents a future value — pending, then either fulfilled or rejected.

A Promise is a placeholder for a result that isn't ready yet. It starts pending, then settles once: fulfilled (with a value) or rejected (with an error). new Promise((resolve, reject) => …) creates one, but you'll mostly consume promises returned by APIs like fetch rather than build your own.

Power-ups you unlock

Race Condition Rex attacks — common mistakes

Boss battleCreate a promise that resolves after a timeout and log its value.

Example code

<!doctype html><html><head><meta charset="utf-8"></head>
<body style="background:#06040d;color:#e6e0ff;font-family:monospace;padding:20px"><pre id="o"></pre>
<script>const p=new Promise(res=>setTimeout(()=>res('done'),400));
p.then(v=>document.getElementById('o').textContent='resolved: '+v);</script></body></html>
▶ Open the interactive comic issue
‹ Callback Hell · The Nested ProblemPromises · Then · Catch · Finally ›