Skip to content
dreamcode
dreamcode
Map
Async & await
Lesson 33 of 48
+15 XP on finish
JAVASCRIPT CLIMBSChapter 6 · JS Async and Errors

Promises and Async/Await

Promises represent future values. The modern async/await syntax lets you write asynchronous code that reads like synchronous code.

Worked example

How it reads

  • async keyword marks a function as asynchronous
  • await pauses execution until the promise resolves
Cloud tip: Always wrap your await calls in a try...catch block to handle network errors safely.
index.js
JAVASCRIPT
real JavaScript, runs in your browser
Console
Run your code to see its output here.
YOUR TURN

Make delayedGlow wait 50 milliseconds with setTimeout before resolving, and log ready before awaiting it. The output should be ready then glow.

Press Run to check your work.