JavaScript_note 3 advantages of using external files

JavaScript_Note 3 Use external files without embedding code

There is no problem to embed JavaScript code in HTML, but it is recommended to use external files to include JS code as much as possible.
Using external files to include JavaScript code has the following advantages:

  1. Easy to maintain: Putting JavaScript in a folder makes it easier to maintain. Developers can focus on editing JavaScript code without touching HTML.
  2. Cacheable: If multiple pages use the same script file, they only need to be loaded once. Can speed up page loading speed.

Guess you like

Origin blog.csdn.net/qq_43263320/article/details/112669042