What would be the output of setImmediate
and setTimeout
in the following code:
console.log("11111");
setImmediate(function A(){
console.log("2222");
});
console.log("3333");
setTimeout(function B(){
console.log("4444");
},0);
console.log("5555");
Output:
11111
3333
5555
4444
2222
when i change time in setTimeout
time to 10, output :
11111
3333
5555
2222
4444
Can anybody explain me this behaviour?