External script files
- It is much easier to analyze so that you can debug and read more efficiently. It makes life a lot easier for us as programmers.
- Download time is reduced as the external file is cached, so it can be downloaded from the website.
- Instead of writing the same script multiple times, the external file can be called and executed anywhere in the code
External files slow down the page rendering speed because the browser must stop parsing and load the external file. This adds a round-trip network, which will slow down everything. In addition, since external files are cached, it is difficult to delete them if they have been updated.
Inline code
- Embedded code reduces the number of HTTP requests, improving web page performance. This is because the code loads on the same page, so no request is required.
- Inline script runs immediately
Although inline code is much harder to read and parse, it just looks like a piece of code put together. It is hard work to find a problem while debugging, making the life of a programmer tough.
Hope this helps you understand a little more :)
LukeP_8
source share