First of all, let's create a new directory named js and add the myAlert.js script inside:
// js/myAlert.js alert('9');
Then in our index.html we add this one:
In this example it is expected that the alert() methods are called in this order:
9 - 1 - 2 - 3 - 4 - 5 - 6
Actually, we have as result:
9 - 2 - 5 - 6 - 3 - 4
Weird, isn't it?
The call of the myAlert.js file is in the src property of the <script> tag.
It means that all what is between the <script> and </script> tag are not called because there is already a src property.
So you can add all that you want, it will be never executed.
But after the execution of the two JS functions inside the <body> tag, the functions, in the onload property of the <body> tag, are executed.
So the functions inside the <body> are executed before ones on the onload property of this same <body> tag.