DEV Community

Ajay Baraiya
Ajay Baraiya

Posted on

Event Loop #Node.js Quick Notes.

Remember below things first before starting understanding Event Loops.

  1. The Node.Js JavaScript Code Runs On A Single Thread.
  2. 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.

Top comments (0)