Last active
March 18, 2021 02:18
-
-
Save aslushnikov/ab5045bf485389136e03e72360bcae33 to your computer and use it in GitHub Desktop.
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
task1: setimmediate | |
task2: setimmediate | |
task1: promise resolved |
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
let resolve; | |
const promise = new Promise(x => resolve = x); | |
promise.then(() => console.log('task1: promise resolved')); | |
setImmediate(() => { | |
console.log('task1: setimmediate'); | |
resolve(); | |
}); | |
setImmediate(() => console.log('task2: setimmediate')); |
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
task1: setimmediate | |
task1: promise resolved | |
task2: setimmediate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment