1.

Where is the right place to include JavaScript code in your HTML and why?

Answer»

JAVASCRIPT code should be placed at the bottom of the HTML document. This is because the JavaScript code is generally huge and complex. If JavaScript code is INCLUDED before the HTML body, the browser will wait for the JavaScript code to load before RENDERING the document. This will SLOW down the overall loading of the website. On the other hand, adding JavaScript at the bottom ensures that the browser is not blocked from rendering the HTML document due to the loading of JavaScript.



Discussion

No Comment Found