Skip to content

Commit

Permalink
Issue #2015 Fix typo in event loop explanation (#2016)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chalarangelo committed Sep 25, 2023
2 parents 0b2b29c + e343fdb commit 48ba9e4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion content/snippets/js/s/event-loop-explained.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Does the output look like what you expected? Let's break down what's happening,
7. The Event Loops has finished its current Task, evaluating the script. It then begins running the first Microtask in the Microtask Queue, which is the callback of `Promise.prototype.then()` that was queued in step 5.
8. `console.log()` is pushed to the Call Stack and executed, logging `'Promise.then() #1'`.
9. `Promise.prototype.then()` is pushed to the Call Stack and executed. This creates a new entry for its callback function in the Microtask Queue.
10. The Event Loop checks the Microtask Queue. As it’s not empty, it executes the first Microtask, which is the callback of `Promise.prototype.then()` that was queued in step 10.
10. The Event Loop checks the Microtask Queue. As it’s not empty, it executes the first Microtask, which is the callback of `Promise.prototype.then()` that was queued in step 9.
11. `console.log()` is pushed to the Call Stack and executed, logging `'Promise.then() #2'`.
12. Re-rendering would occur here, if there was any.
13. The Microtask Queue is empty, so the Event Loop moves to the Task Queue and executes the first Task, which is the callback of `setTimeout()` that was queued in step 3.
Expand Down

0 comments on commit 48ba9e4

Please sign in to comment.