JavaScript Promises

Learn how to write asynchronous JavaScript with the Promises Syntax.

Start[missing "en.views.course_landing_page.asynchronous-javascript.course_illustration" translation]
JavaScript Promises
Lesson 1 of 1
  1. 1

    In web development, asynchronous programming is notorious for being a challenging topic. An asynchronous operation is one that allows the computer to "move on" to other tasks while waiting for ...

  2. 2

    Promises are objects that represent the eventual outcome of an asynchronous operation. A [...] object can be in one of three states: *Pending: The initial state— the operation has not ...

  3. 3

    Let’s construct a promise! To create a new [...] object, we use the [...] keyword and the [...] constructor method: [...] The [...] constructor method takes a function parameter called th...

  4. 4

    Knowing how to construct a promise is useful, but most of the time, knowing how to consume, or use, promises will be key. Rather than constructing promises, you'll be handling [...] objects ret...

  5. 5

    The initial state of an asynchronous promise is [...] , but we have a guarantee that it will settle. How do we tell the computer what should happen then? Promise objects come with an aptly named ...

  6. 6

    To handle a "successful" promise, or a promise that resolved, we invoke [...] on the promise, passing in a success handler callback function: [...] Let's break down what's happening in the exam...

  7. 7

    One way to write cleaner code is to follow a principle called separation of concerns. Separation of concerns means organizing code into distinct sections each handling a specific task. It enables...

  8. 8

    One common pattern we'll see with asynchronous programming is multiple operations which depend on each other to execute or that must be executed in a certain order. We might make one request to a d...

  9. 9

    Promise composition allows for much more readable code than the nested callback syntax that preceded it. However, it can still be easy to make mistakes. In this exercise, we'll go over two common m...

  10. 10

    When done correctly, promise composition is a great way to handle situations where asynchronous operations depend on each other or execution order matters. What if we're dealing with multiple promi...

  11. 11

    Awesome job! Promises are a difficult concept even for experienced developers, so pat yourself on the back. You've learned a ton about asynchronous JavaScript and promises. Let's review: + Promises...

How you'll master it

Stress-test your knowledge with quizzes that help commit syntax to memory

Pro Logo

JavaScript Promises

Start[missing "en.views.course_landing_page.asynchronous-javascript.course_illustration" translation]