Is there a difference in loading order between these 2 approaches? Is there a best practice for this?
Approach 1:
HTML
<script src="test.js"></script>
<script>test()</script>
test.js
function test() {
alert("Hello World!")
}
Approach 2:
HTML
<script src="test.js"></script>
test.js
test()
function test() {
alert("Hello World!")
}