Organizing Your Files
It’s important to be organized. Having all your scripts in one place allows you to manage your files easily and it prevents cluttered file space. For this tutorial series, we’ll be have an index.html file and a folder called js for our scripts.
Create these and then open up the index.html file. Insert this bit of code.
For the most part, you should be familiar with most of these tags. This won’t change much and we’ll be using this file constantly throughout the series.
We don’t have a file named script.js yet. Create this file inside your js folder and insert this bit of code.
alert( 'This is an alert message!' );
Try loading your HTML document in your browser and you should see a pop up with the message:
This is an alert message!
Congratulations! You just created your first JS script. How does it work though?
Inside the alert() function, you type in your message. Your message should be wrapped in quotes or else you’ll get an error