Output: 5, 4, 1, 3, 2. Why?Process.nexttick was supposed to add callbacks to the queue at the next point in time and should take precedence over promise.then, but why didn't that happen? NextTick was executed last and my expectation was 5, 3, 4, 1, 2. What did I miss?
setTimeout(() => {
process.nextTick(() => {console.log(2)})
console.log(1)
}, 0)
new Promise(resolve => {
resolve()
}).then(() => console.log(4))
process.nextTick(() => {console.log(3)})
console.log(5)```