Arjun Mehta1 month agoMost voted10
Promise callbacks go to the microtask queue, setTimeout goes to the task (macrotask) queue. After the current script finishes, the event loop runs all microtasks first, then one task.
So A, D (sync), C (microtask), B (task). 0ms just means "not before 0ms", not "right now".