- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Event Loop
JavaScript Asynchronous
JavaScript Event Loop
The event loop decides what runs next when the call stack is empty.
This is the mechanism behind everything in this section.
It also explains one of the most common interview questions in JavaScript.
Example
Example
javascript
console.log("first");
setTimeout(function () {
console.log("fourth");
}, 0);
Promise.resolve().then(function () {
console.log("third");
});
console.log("second");