The question that alert blocking threads causes the execution of functions in the event queue to be out of order

for(let i=0;i<5;iPP){
    setTimeout(() => {
      alert(i);
      // console.log(i);
    }, 0);
}

code, such as the above, has been tried in browsers such as chrome,safari, which will lead to confusion in the execution order of console.log code. A lot of explanations have been checked on the Internet, but the disorder can not be changed after testing. But there is nothing wrong with the same code in Firefox.
there are a few questions now:

  1. does alert blocking threads cause functions in the event queue to be out of order?
  2. how does the browser alert work?
Mar.22,2021
Menu