Created
May 19, 2023 20:00
-
-
Save acidDrain/e0058d884a2f0e43c21bf8fbf8b34048 to your computer and use it in GitHub Desktop.
Demonstrate the JavaScript event-loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
console.log("Before setTimeout\n"); | |
setTimeout((): void => { | |
// prints out "2", meaning that the callback is not called immediately after 500 milliseconds. | |
console.log("Inside 'setTimeout' callback\n"); | |
}, 1000); | |
console.log("After 'setTimeout'\n"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment