Expanded Library

Refactoring JavaScript Promises with Async/Await

What you'll learn

In this project, you'll learn how to refactor traditional JavaScript promises into ones using Async/Await. You'll also learn how to use Promise.all() and Promise.race() successfully.

Table of contents

  • Set up your local environment for this project. We'll walk you through everything you need to know, including how to install and configure your environment to be able to complete all of the tasks.
Simulate a Fetch Call with setTimeout()
  • Learn how to use setTimeout() to simulate an asynchronous call.
Fetching Movies with a Traditional Promise
  • In this module, we will fill in the fetchMovies function in index.js.
Run Multiple Promises with Promise.all() and Promise.race()
  • Learn how to run promises in parallel with Promise.all() and Promise.race().
Make Async/Await Version of fetchMovies()
  • Have fetchMovies() use async/await syntax instead of traditional promises.
Make Async/Await Version of fetchBooks()
  • Have fetchBooks() use async/await syntax instead of traditional promises.
Create Async versions for Promise.all() and Promise.race()
  • Turn our functions utilizing Promise.all() and Promise.race() into async functions.
Enable Error Handling
  • In this module, you'll learn how to handle errors in promises.
Creating and Clearing Timers
  • Learn to create and clear timeouts created with setTimeout().

About the author

Marques has been involved with software development for years, specializing in Javascript application architecture, hybrid mobile application development, and Node.js applications. As a family man living in Chicago, he's had the chance to work with large enterprises doing legacy code optimization and refactoring, and startups building from the ground up. I'm passionate about experimenting with Javascript frameworks and libraries and figuring out what would work best for my current team/project. ... more

Ready to upskill? Get started