.js extension) by giving the
script tag a
This is the same process as including an external CSS file. The value of
src is just the path to the file you want to include. This path can be both relative, like this:
or absolute, like this:
script tag right before the closing
body tag, and you're good to go!
Here's an example:
script tags inside the
head tag. Here is the example that you ran in the first lesson.
The code inside the
script tags will be executed by the browser right away.
While not important to know as of now, here is an example of it:
<a href="#" onclick="alert('Hi');">Click Me</a>
To access your console on Chrome (and most browsers in general), right-click on the page, and select Inspect.
What you see now is your Developer Tools window. From here you can do many cool things such as monitor how much data has been transferred between you and the server, how long that has taken, and adjust CSS styles on the fly.
However, what we are interested in right now is getting to the console. To do so select the Console tab at the top.
Single Line Comments
To add a single line comment, you just prepend what you want as a comment with two slashes, like this:
let x = 0; // this is a comment
Multiple Line Comments
When you need your comments to span multiple lines, simply place your comment after
/* and before
*/. Everything that gets put inside of those two will be ignored by the browser.
let y = 1; /* this is also a comment */