Since Node.js is single-threaded, it has to be non-blocking to prevent the thread from spending too long on a task that takes a while to complete. The event loop is responsible for enabling this non-blocking behavior. Its job is to schedule pending tasks using the application thread.
We know that Node uses callbacks to handle the response returned by an asynchronous function when its task is complete. Similar to the event that created the task, the completion of the task also emits an event. Node.js adds these events that require handling to an event queue.
The event loop iterates over events in the event queue and schedules when to execute their associated callback functions.