Event Loop in JavaScript
Understand the event loop
AdvancedAdvanced JSExample 11 of 12
event-loop.js
1console.log('1');2setTimeout(() => console.log('2'), 0);3Promise.resolve().then(() => console.log('3'));4console.log('4');
Output
1 4 3 2
What's going on
Event Loop manages asynchronous execution.