Created
March 9, 2018 01:54
-
-
Save szanata/2901bd847aa462994688a604554b1df3 to your computer and use it in GitHub Desktop.
JS: Which is faster?
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
p = new Promise((r) => {r()}); | |
setImmediate(console.log, 'I1') | |
process.nextTick(() =>console.log('T1')); | |
p.then(() => console.log('P1')); | |
process.nextTick(() =>console.log('T2')); | |
// Output: | |
// T1 | |
// T2 | |
// P1 | |
// I1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment