JavaScript Developer — Medium
Key points
- The setTimeout function is asynchronous and runs after the loop completes.
- The value of i is 3 when the setTimeout function executes.
- This behavior is due to JavaScript's event loop mechanism.
Ready to go further?
Related questions
