What is the difference between placing the <script> or <style> tags INside or OUTside the <head> or <body> tags? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 3

What is the difference between placing the <script> or <style> tags INside or OUTside the <head> or <body> tags?

I wrote this example to illustrate my question. Notice that the <script> and <style> tags are NOT placed inside the <body> OR the <head> and it still works. Why is this style of programming not mentioned in the "JS Main Course"? Does it make a difference? https://code.sololearn.com/WqXwV16OJpFx/?ref=app

24th Sep 2018, 2:53 PM
couscous
4 Réponses
+ 3
JavaScript is a known language to freely allow mistakes, it is more correct to put <script> in the <head> section, yet practically doesn't matter mostly.
25th Sep 2018, 6:44 AM
Eldar Bakerman
0
So it is more like a coding standard to ensure consistency. Thank you! :)
25th Sep 2018, 8:47 AM
couscous
0
Yup! Make sure to mark my answer as best if it satisfied you ūüėČ
25th Sep 2018, 10:23 AM
Eldar Bakerman
0
ūüĎć
25th Sep 2018, 10:24 AM
couscous