Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

Asynchronous Programming with JavaScript Course (How To)

via Treehouse

Overview

In this course, you will learn why asynchronous code matters and how to write code that avoids blocking behavior using three approaches: callbacks, promises, and async/await.

What you'll learn

  • Synchronous vs. asynchronous programming
  • Callbacks
  • Promises
  • Async/await

Syllabus

What is Asynchronous Programming?

In this stage, you'll learn the differences between synchronous and asynchronous code. You'll also get an introduction to the mechanics of asynchronous programming in the browser, learning concepts like JavaScript's call stack and event loop.

Chevron 6 steps
  • Introduction to Asynchronous JavaScript

    2:45

  • Understanding Synchronous and Asynchronous Code

    3:25

  • Examples of Synchronous and Asynchronous Code

    5:20

  • instruction

    The JavaScript Call Stack

  • instruction

    The Callback Queue and Event Loop

  • Asynchronous Programming Review

    7 questions

Asynchronous JavaScript with Callbacks

Asynchronous code is typically structured in a different way than synchronous code. One of the most fundamental ways to structure async programs in JavaScript is with callback functions. In this stage, you'll learn how to use callbacks to handle the results of asynchronous operations, as well as some of the drawbacks and potential pitfalls of using them.

Chevron 7 steps
  • Introducing the Project

    2:03

  • instruction

    Callbacks Review

  • Async Programming and Callback Functions

    4:52

  • Implement a Callback

    5:21

  • Stepping Through Async Code

    3:29

  • Managing Nested Callbacks

    2:59

  • Callback Functions Review

    6 questions

Understanding Promises

Promises in JavaScript offer a more elegant and human-readable way to manage asynchronous code. In this stage, you'll learn how to create and consume a promise, then how to chain promises together.

Chevron 11 steps
  • What is a Promise?

    3:36

  • Create a Promise

    4:43

  • Reject a Promise and Handle Errors

    3:25

  • instruction

    Promises Review

  • Create a Promise Review

    6 questions

  • From Callbacks to Promises

    5:59

  • Handle Multiple Promises with Promise.all

    3:35

  • instruction

    Before You Continue

  • Perform Cleanup With finally()

    2:47

  • Using Fetch

    6:21

  • JavaScript Promises Review

    6 questions

Exploring Async/Await

The keywords async and await, together, provide a special syntax that makes working with promise-based code easier and more intuitive –– you write asynchronous code that looks more like synchronous code. In this stage, you'll learn how to combine async/await with traditional promises, and common ways to handle exceptions when working with async/await.

Chevron 5 steps
  • What is Async/Await?

    3:08

  • Convert Promise Handling to Async/Await

    7:44

  • Combine Async/Await with Promises

    2:31

  • Error Handling with try...catch

    6:08

  • Async/Await Review

    6 questions

Taught by

Guil Hernandez

Reviews

Start your review of Asynchronous Programming with JavaScript Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.