Tapas Adhikary
I didn't understood the 11th point in the above explanation.
setTimeout(tom, 50);
setTimeout(doggy, 30);
The task queue is filled this way:
[tom(), doggy()]
So why isn't the output this because task queue is a task so FIFO no matter the timeout duration:
Cartoon
Jerry
I am a Promise, right after tom and doggy! Really?
I am a Promise after Promise!
Tom
Doggy
Vedamruta Udavant No for setTimeout, setInterval kind of web APIs it will be filled based on the delayed time. That's the catch you need to keep in mind. So it will [doggy(), tom()] this way.