15. Asynchronous Tasks

Overview

By the end of this chapter, you will be able to implement asynchronous programming and its different techniques; explore the pitfalls of callback hell and the pyramid of doom; illustrate the use of promises to execute code upon operation completion; use the new async/await syntax to make asynchronous code look and feel almost sequential; and apply the Fetch API to make remote service calls.

Introduction

Asynchronous tasks allow the execution of the main thread of a program to proceed even while waiting for data, an event, or the result of another process, and achieve snappier UIs as well as allowing some types of multitasking.

Unlike other languages that can have many concurrent threads executing, JavaScript ...

Get The JavaScript Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.