How JavaScript Promise Works: Synchronizing the Main Thread and Call Stack
Once an asynchronous task completes, a Promise either resolves or rejects. But instead of returning control immediately to the main thread, resolved or rejected Promises are sent to a special queue called the Microtask Queue.