Created
May 19, 2021 15:52
-
-
Save SmolinPavel/985302f0fdd6ccbfddbd2fe96eed0680 to your computer and use it in GitHub Desktop.
JS console.log quest (micro/macro task queues)
This file contains hidden or 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
// what will be the output to the console? | |
console.log(1); | |
setTimeout(() => { | |
console.log(2); | |
setTimeout(() => console.log(3), 200); | |
}, 200); | |
new Promise(() => console.log(4)); | |
setTimeout(() => console.log(5), 0); | |
Promise.resolve().then(() => console.log(6)); | |
setTimeout(() => console.log(7), 400); | |
new Promise((resolve) => { | |
setInterval(() => resolve(8), 100); | |
}).then(console.log); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment