When we call the setTimeout (2 sec) function, we're actually registering the event callback pair in the Node APIs. The event is simply to wait two seconds, and the callback is the function we provided, the first argument. When we call setTimeout, it gets registered right in the Node APIs as shown here:

Now this statement will finish up, the Call Stack will move on, and the setTimeout will start counting down. Just because the setTimeout is counting down, it doesn't mean the Call Stack can't continue to do its job. The Call Stack can only run one thing at a time, but we can have events waiting to get processed even when the Call Stack is executing. Now the next statement that runs is the other call to setTimeout:

In this, we register a setTimeout callback function with a delay of 0 milliseconds, and the exact same thing happens. It's a Node API and it's going to get registered as shown in the following screenshot. This essentially says that after zero seconds, you can execute this callback:

The setTimeout (0 sec) statement gets registered and the Call Stack removes that statement.