Skip to content

Instantly share code, notes, and snippets.

@matadcze
Created March 20, 2023 17:18
Show Gist options
  • Save matadcze/aff3f2771873d5c3ae470da36fd245e1 to your computer and use it in GitHub Desktop.
Save matadcze/aff3f2771873d5c3ae470da36fd245e1 to your computer and use it in GitHub Desktop.
const fs = require("fs");
setImmediate(() => console.log(1)); // 8
Promise.resolve().then(() => console.log(2)); // 3
process.nextTick(() => console.log(3)); // 2
fs.readFile(__filename, () => {
console.log(4); // 1
setTimeout(() => console.log(5)); // 4
setImmediate(() => console.log(6)); // 7
process.nextTick(() => console.log(7)); // 6
});
console.log(8); // 5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment