The first thing that exists in the head tag for the execution order of the script statement is executed
After that, I thought it would be executed in the order of body tags.
However, when I tested it as below today, it was printed in the order of Warning 1-> Warning 2-> Warning 3, and p-tag output (I'm not sure if it's running at the same time or one of the two is running first) -> Warning 4-> Warning 5
.
If my knowledge is correct,
Warning 1 -> ptag output -> Warning 2 -> Warning 3 -> Warning 4 -> Warning 5 seems correct, but I'm not sure why.
Why is this happening?
<!DOCTYPE html>
<script>
alert('11111111')
</script>
</head>
<body>
<p> Order is Warning 1 -> output ptag -> Warning 3 -> Output 4 in order </p>
<script>alert('222222') </script>
<script>alert('333333') </script>
<script>alert('444444') </script>
<script>alert('555555') </script>
</body>
</html>
I think it's only in Chrome browser. It's printed as you thought on other browsers. I think it would be good to learn about the Chrome browser domrender. We recommend you ask the Stack Overfloor or JavaScript Developer Forum. I don't know either...
Firefox 57.0.2
IE 11
© 2024 OneMinuteCode. All rights reserved.