Sunday, 8 September 2013

Javascript loading order

Javascript loading order

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!")
}

No comments:

Post a Comment