Skip to content

Instantly share code, notes, and snippets.

@naazeri
Last active March 31, 2023 08:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save naazeri/e55b0011eeb20fa46e540ccf01d25d37 to your computer and use it in GitHub Desktop.
Save naazeri/e55b0011eeb20fa46e540ccf01d25d37 to your computer and use it in GitHub Desktop.
setTimeout(() => {
console.log("timeout 1")
Promise.resolve().then(() => {
console.log("p1")
})
}, 0)
setTimeout(() => {
console.log("timeout 2")
}, 0)
setTimeout(() => {
console.log("timeout 3")
Promise.resolve().then(() => {
console.log("p2")
})
process.nextTick(() => {
console.log("t1")
})
}, 0)
process.nextTick(() => {
console.log("t2")
})
process.nextTick(() => {
console.log("t3")
})
Promise.resolve().then(() => {
console.log("p3")
Promise.resolve().then(() => {
console.log("p4")
})
})
Promise.resolve().then(() => {
console.log("p5")
process.nextTick(() => {
console.log("t4")
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment