Where should I declare JavaScript files used in my page? In <head></head> or near </body>?

后端 未结 12 975
后悔当初
后悔当初 2020-11-27 15:07

I was reading a tutorial and the author mentioned to include Javascript files near closing body tag () in HTML.

I was wonderi

12条回答
  •  心在旅途
    2020-11-27 15:44

    I like to load a small js file in the head, that handles (1) anything that happens before the page is rendered and (2) the loading of other script files after the page loads, or as needed.

提交回复
热议问题