Intro to JavaScript Classes Setup
Open your Terminal application and navigate to your ~/code/ga/lectures directory:
cd ~/code/ga/lectures
Make a new directory called intro-to-javascript-classes, then enter this directory:
mkdir intro-to-javascript-classes
cd intro-to-javascript-classes
Create a directory called js:
mkdir js
Then, create an index.html file, as well as a app.js file inside the js directory. These files will hold your work for this lecture:
touch index.html ./js/app.js
With the files created, open the contents of the directory in VS Code:
code .
Open the index.html file and add HTML boilerplate by typing ! and then hitting the Tab key. Then link the app.js file inside of the js directory by adding this line inside the <head> tag:
<script defer src="./js/app.js"></script>
With this setup complete, we’ll have two methods at our disposal for executing the code we write in app.js:
-
Open the
index.htmlfile in your browser and access the console output in your browser’s dev tools. -
Use node to execute the
app.jsfile directly by using this command in your terminal:
node app.js
While either method is acceptable, you should use the same method as your instructor for simplicity.