r/learnjavascript • • May 19 '26

Doubt regarding async events management.

I am currently learning JavaScript and recently came across a fact that all the async work in managed by external APIs written in C++.

My doubt was how is the queue managed and how the priority is decided if two events happen to free on same time. I have read about micro task and macro tasks queues but still not satisfied.

Also earlier sometime I had solved a leetcode question related to task scheduling which uses a queue and a priority queue based approach so was wondering if something similar happens in case of JavaScript as well.

Thanks.

PS : Leetcode#621 if anyone interested in having a look

0 Upvotes

Duplicates