Advantages of external JavaScript over inline JavaScript : Here are some of the general advantages of external JavaScript over inline JavaScript
Maintainability : JavaScript in external files can be referenced on multiple pages without having to
duplicate the code inline on every page. If something has to change, you only have one place to change.
So external JavaScript code can be reused and maintenance will be much easier.
Separation of Concerns : Storing JavaScript in a separate external .js file adheres to Separation of concerns design
principle. In general it is a good practice to separate HTML, CSS and JavaScript as it makes it easier working with them.
Also allows multiple developers to work simultaneously.
Performance : An external JavaScript file can be cached by the browser, where as an inline JavaScript on the page is
loaded every time the page loads.
No comments:
Post a Comment