“Don’t put bad, synchronous code on the call back stack because it prevents a fast, crisp user interface.” https://www.youtube.com/watch?v=8aGhZQkoFbQ
The call-stack is different than any other modern programming language. In Python or C++, code executes sequentially so that whenever you make a call, you can guarantee that the variable will take on that value when you reference it later in the program. That is why thinking aynchonously can be so hard – our traditional programming paradigms are called into question.
This all works with something called the event loop, which manages the call-stack. It processes different instructions, in a loop until it is empty. It may be called an event loop because it processes each item in the call-back queue, little by little.
This makes programming very difficult though because now there needs to be a callback function for when a call completes. These callback functions can cause problems like callback hell, where it makes code illegible, bad, and makes us unable to write complex code like Promises.all(). Promises sort of solve this, but the standard today is to use async await – which I need to study a bit more and will write a blog about.