Chapter 9. Asynchronous Programming and Promises

Asynchronous programming is a part of the nature of JavaScript since its birth. Regardless of the runtime environment of JavaScript, you cannot ignore the execution of asynchronous code, whether it is the management of user's interaction with a graphical interface or the interaction with a server or a hardware component of the system.

This chapter will discuss how to manage asynchronous code in JavaScript by analyzing the classical approach based on callback functions, pointing out its intrinsic drawbacks and exploring new approaches such as the ones based on Promises and Generators.

The following topics will be discussed in the chapter:

  • Events and asynchronous calls
  • Callback functions
  • Troubles with ...

Get Mastering JavaScript Object-Oriented Programming 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.