JavaScript, React, Programming, Web Development, Front End Development.
task queues are Render Task Queue, Micro Task Queue and Callback Queue. The first two console will be printed right away 1 and 4. Now the fight is b.w. setTimeout and Promise. Promise being a micro task, will go inside micro task queue and will be executed before the callback queue. Resulting in