File > Open Folder
New File
)Web pages are made up of a few different types of file. the most common ones which you will find in almost every site are Hyper Text Markup Language (HTML), Cascading Style Sheets (CSS), and JavaScript (JS).The above snippet is HTML, and it consists of a number oftags
used to "markup" the text. The tags indicate to the browser what type of content the contained text is. For example, ourh1
tag tells the browser that we are dealing with a Level 1 Heading, and thep
tag indicates that we are working with a paragraph. The current HTML5 standard includes around 150 tags, but a lot of them are very niche, and you certainly don't need to remember each and every one. For a good reference about different tags, look hereβ
p
tag, but before the closing body
tag, add the following:script
tag, it will run all the code contained within before continuing on. Because of this, we tend to put the script tags at the bottom of the page most of the time, so that they won't slow down the loading of the page too much.console.log is a function which tells the browser to display some information in the dev tools console. this is super hand for debugging issues and check whats what as you write your code. To see the fruits of you labour, right click somewhere on your page, and selectinspect
. In the new window that pops up, go to theconsole
tab, and you should see the output of your script.
console.log
with alert
so that the contents of your script tag reads likescript.js
and move the contents of your script tag into this file.<!--
and end with -->