Chapter 1: Asynchrony: Now & Later
This is not just about what happens from the beginning of a loop to the end of a for
loop, which of course takes some time (microseconds to milliseconds) to complete. It’s about what happens when part of your program runs now, and another part of your program runs later — there’s a gap between now and later where your program isn’t actively executing.
In fact, the relationship between the now and later parts of your program is at the heart of asynchronous programming.
But as JS continues to grow in both scope and complexity, to meet the ever-widening demands of a first-class programming language that runs in browsers and servers and every conceivable device in between, the pains by which we manage asynchrony are becoming increasingly crippling, and they cry out for approaches that are both more capable and more reason-able.
But before we can get there, we’re going to have to understand much more deeply what asynchrony is and how it operates in JS.