DEV Community

Discussion on: ✨♻️ JavaScript Visualized: Event Loop

Collapse
 
jeannotmn profile image
Jeannot MN

Functions are pushed into the the call stack when the callstack is empty AND there are no other line of code to be executed in the main thread... in your case it was not pushed because there was still one more thing to execute in the main thread of execution (the second hello()); Only after completing the second call to the hello function that your callback will be pushed into the callstack...

I hope this helps.