Chapter 6. Understanding asynchronous flow control methods in JavaScript
This chapter covers
- Understanding callback hell and how to avoid it
- Making Promises and keeping them in JavaScript
- Using asynchronous control flow
- Learning event-based programming
- Using Harmony (ECMAScript 6) generator functions
Chapter 5 taught the importance of building your components in a modular fashion, and you learned a great deal about scoping, hoisting, and closures, all of which are necessary to understand asynchronous JavaScript code effectively. Without a modest understanding of asynchronous development in JavaScript, it becomes harder to write quality code that’s easy to read, refactor, and maintain.
One of the most frequently recurring issues for JavaScript development beginners is dealing with “callback hell,” where many functions are nested inside each other, making it hard to debug or even understand a piece of code. This chapter aims to demystify asynchronous JavaScript.