Asynchronous Programming

Out of all chapters in this book, this is my favorite, because I've faced the consequences of bad asynchronous programming in the past, with callbacks on event listeners, HTTP requests, and basically everything that requires latency. 

JavaScript has evolved from all these cluttered, unreadable, unmaintainable programming practices and that's what we're going to learn in this chapter.

Anyway, let's learn what an asynchronous program is. You can think of an asynchronous program as a program consisting of two lines of code, say L1 and L2. Now, we all know that in a given file, the code always executes from top to bottom. Also, it is intuitive such that the code will wait for each line to complete before executing the ...

Get Learn ECMAScript - Second Edition 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.