Understanding Asynchronous JavaScript

Asynchronous JavaScript :)

pexels-markus-spiske-1089440.jpg

JavaScript is a single-threaded programming language. single-threaded means only one thing can happen at a time and having each operation started only after the preceding operation is completed.

while it's a single-threaded language so you don't have to worry about the concurrency issues, this also means that you can't perform long operations such as network access without blocking the main thread.#

Imagine requesting some data from an API is a time taken process so we have to wait for the response then and only then do we proceed to the further execution that makes our webpage unresponsive.

That’s where asynchronous JavaScript comes into play. Using asynchronous JavaScript (such as callbacks, promises, and async/await), you can perform long network requests without blocking the main thread.

While it’s not necessary that you learn all these concepts to be an awesome JavaScript developer, it’s helpful to know :)