While running setTimeout and setImmediate together, Why values are changing for same program when we running it again and again. (setTimeout's timing is 0).
setImmediate(() => {console.log("1")});
setTimeout(()=>{console.log('a')},0)
setTimeout(()=>{console.log('b')},0)
setImmediate(() => {console.log("2")});
While running the program for 1st time output : 1 2 a b
While running the same program for 2nd time output : 1 2 a b
While running the same program for 3rd time output : a 1 2 b
While running the same program for 4th time output : 1 2 a b
While running the same program for 5th time output : a 1 2 b
even it is changing the total order after running n times....
it continuously changing result order when we running it again and again the same program without changing anything.