Created
March 20, 2023 17:36
-
-
Save matadcze/53569aa274f25329893479c23a834303 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
const sleep_st = (t) => new Promise((r) => setTimeout(r, t)); | |
const sleep_im = () => new Promise((r) => setImmediate(r)); | |
(async () => { | |
setImmediate(() => console.log(1)); | |
console.log(2); | |
await sleep_st(0); | |
setImmediate(() => console.log(3)); | |
console.log(4); | |
await sleep_im(); | |
setImmediate(() => console.log(5)); | |
console.log(6); | |
await 1; | |
setImmediate(() => console.log(7)); | |
console.log(8); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment