Execution order of js operation DOM and other JS code in browser

the following code:

document.querySelector(".div-bgd").style.display = "block";
document.querySelector(".load_div").style.display = "block";
console.log(1)
alert(1)
In the

browser environment, why execute console and alert statements first instead of the first two statements that have changed styles?
examples are as follows:

Mar.12,2021

learn the execution order of js engine threads and GUI rendering threads
setTimeout solves the problem of GUI rendering thread blocking

Menu