Event Loop #Node.js Quick Notes.
Remember below things first before starting understanding Event Loops.
- The Node.Js JavaScript Code Runs On A Single Thread.
- Node.Js Call Stack Is A LIFO (Last In, First Out) Stack.
When browser loop through events, it gives priority to callstack and everything else like click events, setTimeout timers, load events put into Message queue.
Once callstack finished than it goes to Message queue and take execute it from there.
To make it in sequence we can you Promises and Async/Await.