External JavaScript Advantages
Placing JavaScripts in external files has some advantages:
- It separates HTML and code
- It makes HTML and JavaScript easier to read and maintain
- Cached JavaScript files can speed up page loads
- External scripts are practical when the same code is used in many different web pages.
JavaScript Display Possibilities
JavaScript can "display" data in different ways:
- Writing into an alert box, using window.alert().
- Writing into the HTML output using document.write().
- Writing into an HTML element, using innerHTML.
- Writing into the browser console, using console.log().
Note:- It is a good idea to place scripts at the bottom of the <body> element.
This can improve page load, because script compilation can slow down the display.
This can improve page load, because script compilation can slow down the display.
Comments
Post a Comment