<body>
<button id="btn1">btn1</button>
<button id="btn2">btn2</button>
<p>111111111111111111111111</p>
<p>222222222222222222222222</p>
<script>
var a = 0;
for(var i=0;i<1000000000;i++){
a++;
}
alert('runs1');
</script>
<p>3333333333333333333333333</p>
</body>
<script src="1.js"></script> //1.js 中alert(2);
I would like to ask, the rendering of the page needs to wait until the content before the body is parsed, and then the page will be automatically rendered.
Or do I need to wait until 1.js parsing is completed before rendering the page?
Look at the browser rendering of this article
The rendering of the page is top-down, and the page rendering is higher than your 1.js