Introduction
Javascript is a single-threaded language, so it can only execute one operation at a time. It uses a javascript scheduler to manage long operations such as HTTP calls in order to avoid blocking the main thread.
To understand this you need to know how the event loop handles tasks