JavaScript is an interesting tool. It’s more difficult to describe its purpose than HTML or CSS. Basically, it’s a tool that makes your static website more interactive and functional. HTML and CSS websites are like brochures or PDFs. They’re like looking at a printed piece of paper on the web. They don’t really do anything. All you can really do is look at them. Remember how I said that every little design detail was controlled by CSS? Well, every little interactive aspect of a website is controlled by JavaScript. The little popup box that lets you chat in real-time with your friends is controlled by JavaScript. The popup that appears when you create a new event in your calendar website is controlled by JavaScript. I’m getting ahead of myself though. Yes, these features are controlled by JavaScript, but, no, you would not find these features on an HTML/JS/CSS website. JS only provides a certain type of functionality for your website.
There’s another type of functionality that’s missing from HTML/CSS/JS websites. JavaScript gives your website interactive functionality, but it doesn’t give it dynamic functionality. Another word for your HTML/CSS/JS only website is static. You’ll find out what dynamic websites are later on. That’s a different type of website. At this point, your website is static. It doesn’t get data from anywhere, and it doesn’t permanently save data anywhere. Without dynamic functionality (the ability to save data somewhere), JavaScript loses most of its benefit although it can still be useful. For example, JavaScript is used to create slideshows. Without JavaScript, you’d just have one image appearing one after another. Images are another type of static content that you’d upload to your server, just in case you were wondering.
Basically, just keep in mind that the usefulness of JavaScript is greatly limited on static websites.
Like CSS, JavaScript can also be embedded in HTML, or you can put it in a separate file and link to that file from the HTML file. Again, your deployment process doesn’t change that much. You would just be uploading three files instead of one.
These three tools (HTML, CSS, and JS) are used to create static websites. Static websites can be useful. Static websites are perfectly fine for a lot of small businesses. You can think of a static website like a brochure or PDF. It won’t change very often, and that’s completely fine.
Again, don’t forget that these three tools are also used (and necessary) on the more complex websites. And there are many tools to work with these tools, making more powerful (and more complicated). As you add more tools, your website will get more functional and more complicated.