Notes on Pluralsight’s Course “JavaScript Getting Started”

FYI, pretty simple stuff.

Alex Guanga
13 min readJun 6, 2021

--

Photo by Gia Oris on Unsplash

One bit of advice: it is important to view knowledge as sort of a semantic tree — make sure you understand the fundamental principles, i.e. the trunk and big branches, before you get into the leaves/details or there is nothing for them to hang on to. — Elon Musk

PSA: Do not solely rely on online courses. We should include supplementary material for online learning. For example, working on side projects or reading the documentation can reap great benefits. It can feel rewarding to master concepts in an online course but could be deceiving. I highly recommend you find ways to add to your online courses.

JavaScript Beginning

Adding JavaScript Code to a Webpage

JavaScript is a programming language mostly used client-side to make webpages interactive. — Mozilla

Client-side: Client-side indicates that the action took place on the user’s computer. The server-side indicates that the action took place on a web server (i.e., databases).

There are two ways to use JavaScript on the web:

  1. We can add <script> and </script> in the HTML file with an src attribute. Something like <script src="path/to/my/script.js"></script>.
  2. Directly add the JavaScript code between the <script> tag.

Using JavaScript files is easier to manage and helps with reusability. You should not have duplicate code throughout your codebase.

Please read Mozilla’s documentation for best practices.

Working with JavaScript Files

As you would imagine, it’s better to separate our JavaScript files from our HTML files. Some key points:

  • We can include js files in the head or body section. Each serves its own purpose. If we want to load our JavaScript code without impacting the HTML, we can add it to the head section (i.e., alerting, loading libraries, et cetera). If we want our JavaScript to impact the HTML content, we include it in the body section.
  • The order of the JavaScript files in theindex.html file matter. For example, if…

--

--

Alex Guanga

Data Engineer @ Cherre. Mets die-hard. Hip-hop junkie.