Async JavaScript, a Pocket Reference

Learn asynchronous programming in JavaScript

AJ Meyghani
32 min readOct 10, 2018

The asynchronous nature of JavaScript is one of the aspects of the language that can confuse a lot of people. Having a good understanding of its primary async constructs however, can reduce a lot of confusion about the language. The goal of this guide is to introduce you to async programming in JavaScript and provide you with the necessary techniques to write clean and maintainable async code. We will start by exploring synchronous and asynchronous execution models and their differences. Then, we’ll dive into callback functions and examine how they are used to capture results of async operations. After that, we’ll explore promises and learn how they abstract callback functions to simplify async flows. We will also look at generators and explore how they can be used in async flows. And at the end we’ll explore async functions and illustrate how they can be used along with promises to further simplify asynchronous operations.

Code Examples

All the code examples for this guide are available on Gitlab:

https://gitlab.com/aj_meyghani/asyncjs-code-examples

You can either clone the repo or download it as a zip file.

Other Pocket References

--

--