console.log(1)
const promise = new Promise((resolve) => {
console.log(2)
resolve()
console.log(3)
})
console.log(4)
promise.then(() => {
console.log(5)
}).then(() => {
console.log(6)
})
console.log(7);
Output for this block is 1,2,3,4,7,5,6
I do understand that promise callback will go event loop and will run once promise is resolved then how we are getting 2, 3 printed before the promise is resolved. can someone please explain this to me?