Created
July 24, 2023 08:10
-
-
Save ehzawad/76e36a4e899c9035a7fdbfe7ef53bd11 to your computer and use it in GitHub Desktop.
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
| const fs = require('fs'); | |
| console.log(1); | |
| console.log(2); | |
| setTimeout(() => { | |
| console.log('setTimeout'); | |
| }, 0); | |
| console.log(3); | |
| setImmediate(() => { | |
| console.log('setImmediate'); | |
| }); | |
| console.log(4); | |
| process.nextTick(() => { | |
| console.log('nextTick'); | |
| }); | |
| const f1 = () => { | |
| console.log('f1') | |
| setTimeout(() => { | |
| console.log('Hello from f1'); | |
| }, 2000); | |
| } | |
| const f2 = () => { | |
| setTimeout(() => { | |
| console.log('Hello from f2'); | |
| }, 1000); | |
| console.log('f2') | |
| } | |
| console.log(5); | |
| fs.readFile(__filename, () => { | |
| console.log('readFile callback'); | |
| }); | |
| console.log(6); | |
| console.log(7); | |
| Promise.resolve().then(() => { | |
| console.log('promise'); | |
| }); | |
| console.log(8); | |
| f2() | |
| f1() |
ehzawad
commented
Jul 26, 2023
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment