Adding JavaScript to Your Page
Prev Chapter 1. Welcome Next

Adding JavaScript to Your Page

JavaScript can be included inline or by including an external file via a script tag. The order in which you include JavaScript is important: dependencies must be included before the script that depends on them.

For the sake of page performance, JavaScript should be included as close to the end of your HTML as is practical. Multiple JavaScript files should be combined for production use.

Example 1.1. An example of inline Javascript

<script>
console.log('hello');
</script>

Example 1.2. An example of including external JavaScript

<script src='/js/jquery.js'></script>


Copyright Rebecca Murphey, released under the Creative Commons Attribution-Share Alike 3.0 United States license.


Prev Up Next
Software Home JavaScript Debugging