Scripts in the body... Why?!

Hey there, fellows!

I used to learn that [script]s must be declared inside the HTML’s [head]… However, you required us to code those before, yet inside, the [body] major element. So, I was just wondering… “Why? Does it have a particular order? Or, does it depend on the compiler itself?”.

Thanks in advance!


I think you must set your script tags below cause if it above it wil take longer for the page to load.

Sorry for bad english but i am Belgian.

But, does it ALWAYS have to be this way?. Or is it just for Codecademy’s code-compiling system?!. :slight_smile:

@sky7ure <script> tags can go basically anywhere, best practice is to put them just before </body> at the end of your file, but there are times when you need JS to execute early on in the page load, so you put it in the <head>. You should always put your <script>s at the end of the HTML document when possible, though :slight_smile:

1 Like

I see… Thank you @zystvan . 'Much obliged, that is. :slight_smile:

1 Like