What's the difference between using <script> within the body tag and the head tag? How does it differ in terms of functionality? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

What's the difference between using <script> within the body tag and the head tag? How does it differ in terms of functionality?

13th Jun 2016, 9:34 AM
Mitra Thakker
Mitra Thakker - avatar
3 Antworten
+ 4
there is no big difference. it would be better if we put scripts in the body tag because it will not block html to load the page script. if we put it in head tag, it will delay the html to load the page because it must load the script first.
13th Jun 2016, 3:41 PM
Firda Dhea Sauzan
Firda Dhea Sauzan - avatar
+ 1
Page load time on the html. Always place your functions as far down in the page as possible, preferrably load heavy js in the footer :)
14th Jun 2016, 1:47 AM
Vegard Bratteng
Vegard Bratteng - avatar
+ 1
javascript is fun
14th Jun 2016, 3:54 PM
kerbik
kerbik - avatar