macrotask and microtask
{
setTimeout(function(){
console.log(8);
setTimeout(function(){
console.log(9);
new Promise(function(resolve){
resolve();
}).then(function(){
console.log(10);
})
},0);
},20)
console.log(1);
new Promise(function(resolve)
{
console.log(2);
resolve();
}).then(function(){
console.log(4);
})
setTimeout(function(){
console.log(5);
new Promise(function(resolve){
console.log(6);
resolve();
}).then(function(){
console.log(7);
})
},0)
console.log(3);
}