JavaScript : Advantages and disadvantages of External JavaScript ?

Advantages :

Following are the Advantages of javaScript over external :-

  • Reusability of code.
  • Easy code readability.
  • It Enables both web designers and coders to work with html and js files.
  • With these small js files, you can use Google closure or YUI Compressor or other minifying tools to reduce the size and make it not readable by humans .

Disadvantages :

Following are the disadvantages of javaScript over external :-

  • Code can be downloaded using the url of the js file. This can help coders to steal your code easily.
  • If two js files are dependent on one another, then a failure in one file may affect the execution of the other dependent file.
  • A small change to a common js file may cause unexpected results in some of the HTML files .
  • The browser has to make an extra http request to get the js code.
Tagged : / / / / / /