The next thing that happens in our program is we run our console.log statement, which prints Finishing up to the screen. This is the second message that shows up in the Terminal:

This statement runs, our main function is complete, and it gets removed from the Call Stack.
At this point, the Event Loop says hey I see that we have nothing in the call stack and we do have something in the Callback Queue, so let's run that callback function. It will take the callback and move it into the Call Stack; this means the function is executing:

It will run the first line which is sitting on line 8, console.log, printing Second setTimeout to the screen. This is why Second setTimeout shows up after Finishing up in our previous section examples, because we can't run our callback until the Call Stack is complete. Since Finishing up is part of the main function, it will always run before Second setTimeout.
After our Second setTimeout statement finishes, the function is going to implicitly return and callback will get removed from the Call Stack:

At this point, there's nothing in the Call Stack and nothing in the Callback Queue, but there is still something in our Node APIs, we still have an event listener registered. So the Node process is not yet completed. Two seconds later, the setTimeout(2 sec) event is going to fire, and it's going to take that callback function and move it into the Callback Queue. It gets removed from the Node APIs and it gets added to the Callback Queue:

At this point, the Event Loop will take a look at the Call Stack and see it's empty. Then it will take a quick look at the Callback Queue and see there is indeed something to run. What will it do? It will take that callback, add it on to the Call Stack, and start the process of executing it. This means that we'll run our one statement inside callback. After that's finished, the callback function implicitly returns and our program is complete:

This is exactly how our program ran. This illustrates how we're able to register our events using Node APIs, and why when we use a setTimeout of zero the code doesn't run right away. It needs to go through the Node APIs and through the Callback Queue before it can ever execute on the Call Stack.
Now as I mentioned in the beginning of this section, the Call Stack, the Node APIs, the Callback Queue, and the Event Loop are pretty confusing topics. A big reason why they're confusing is because we never actually directly interact with them; they're happening behind the scenes. We're not calling the Callback Queue, we're not firing an Event Loop method to make these things work. This means we're not aware they exist until someone explains them. These are topics that are really hard to grasp the first time around. By writing real asynchronous code it's going to become a lot clearer how it works.
Now that we got a little bit of an idea about how our code executes behind the scenes, we'll move on with the rest of the chapter and start creating a weather app that interacts with third-party APIs.