JavaScript Engine has 1 Call Stack 2 Heap

JS is a single threaded

Web API

Call Base API goes to the task Queue Promise based API get to Microtask Queue

The First preference is given To microtask Queue Over Task Queue, Event Loop make sure that before moving to Task queue The Microtask Queue is Empty