JavaScript Event Loop Explanation

  • No alternative text description for this image

Answer: C Output Start End Promise Timeout Explanation JavaScript executes synchronous code first. 1️⃣ console.log("Start") runs 2️⃣ setTimeout() moves its callback to the Macrotask Queue 3️⃣ Promise.resolve().then() moves its callback to the Microtask Queue 4️⃣ console.log("End") runs After the call stack is empty: • Microtasks run first → Promise • Macrotasks run next → Timeout So the final output becomes: Start → End → Promise → Timeout

See more comments

To view or add a comment, sign in

Explore content categories