Loading video player…

Promises and async/await (Overview)

Welcome to Promises and async/await! When each step of a program waits for the one before, callbacks nest, and nested callbacks get hard to follow. With promises and async functions, code that waits reads from top to bottom again. This course teaches you both.

A Day at the Museum

Throughout the course, you’ll build a planning script for the Adeyemi family’s day at the museum. Tolu, who is nine, Grandma Bisi, and their parents, Folake and Tunde, each pick artworks they want to see. The museum’s old kiosk is slow, and it answers through a callback. Your script looks up every pick and groups the titles by gallery. Tunde’s pick isn’t on view, so the plan says so instead of stopping. Here’s what the finished plan prints:

Language: Text
$ node plan_day.mjs
Couldn't plan 16568: Artwork 16568 isn't on view
{
  'Gallery 241, second floor': [ 'The Bedroom' ],
  'Gallery 262, second floor': [ 'Nighthawks' ],
  'Gallery 240, second floor': [ 'A Sunday on La Grande Jatte — 1884' ]
}

Last, your script asks the real Art Institute of Chicago about one artwork and logs its title, artist, and date. This is the museum’s answer on 26 November 2026:

Language: Text
$ node show_artwork.mjs
A Sunday on La Grande Jatte — 1884
Georges Seurat
1884–86, border added 1888–89

What You’ll Learn

By the end of this course, you’ll know how to:

  • Handle a value that arrives later with a promise
  • Chain steps that depend on each other, and wrap a callback in a promise
  • Write async functions that await each step and catch failures
  • Predict the order of awaited code, promise callbacks and timers
  • Plan the Adeyemi family’s day at the museum

Before You Start

This is the second course in the Async JavaScript and Web APIs learning path, and you can start here. You need to know how to write callbacks that run later, including Node’s error-first callbacks, and how the event loop decides when they run. You also need modules, JSON, and try and catch. If you’d like a refresher, then these RealJS courses cover them:

For tools, you need a current version of Node.js, a terminal, and any editor. The examples use Node.js 26:

Language: Shell
$ node --version
v26.13.1

How the Course Works

The course mixes text lessons and videos, and you run their code in your terminal. Each of the first four sections has a coding exercise in your browser. After a three-exercise project brings it together, an AI mentor session asks you to explain your museum plan’s code in your own words and to make a change you haven’t seen. A quiz and a summary close the course. You also get slides and a code download, a ZIP file with the course’s code.

It all starts with the callbacks you already know. The next lesson, From Callbacks to Promises, starts with why nested callbacks get hard to follow.

Download

Course Slides (.pdf)

611.0 KB
Download

Sample Code (.zip)

17.9 KB

00:00 Welcome to Promises and async/await. When each step waits for the one before, callbacks nest. With promises and async functions, code that waits reads from top to bottom again.

00:15 Here’s a first taste of the planning script you’ll build for the Adeyemi family’s day at the museum.

00:22 Tolu, Grandma Bisi and their parents, Folake and Tunde, each pick artworks. The museum’s old kiosk is slow and answers through a callback. Your script groups every pick by gallery and flags Tunde’s pick, which isn’t on view.

00:39 Last, it asks the real Art Institute of Chicago about one artwork.

00:45 In this course, you’ll learn how to: Handle a value that arrives later with a promise. Chain steps that depend on each other, and wrap a callback in a promise.

00:56 Write async functions that await each step, and catch failures. Predict the order of awaited code, promise callbacks and timers. And plan the Adeyemi family’s day at the museum.

01:10 This is the second course in the Async JavaScript and Web APIs path, and you can start here. You need to know callbacks that run later, error-first callbacks and the event loop.

01:21 You also need modules, JSON, and try and catch. You’ll run the lessons’ code in a terminal, with a current Node and any editor.

01:32 The course mixes text lessons and videos. The first four sections each have a coding exercise in your browser. A three-exercise project brings it together, then an AI mentor session, a quiz and a summary.

01:46 The next lesson, From Callbacks to Promises, starts with why nested callbacks get hard to follow.

Become a Member to join the conversation.