Intro to JavaScript Functions Lab Setup
Setup
Open your Terminal application and navigate to your ~/code/ga/labs directory:
cd ~/code/ga/labs
Navigate to GitHub and create a new repository named intro-to-javascript-functions-lab.
- Make sure the repo is set to
public - You do not need a
README.md - You do not need a
.gitignore
Using the Quick Setup option, clone your newly created repo into your ~/code/ga/labs directory with the git clone command:
git clone https://github.com/<your-username>/intro-to-javascript-functions-lab.git
Note: In the link above, where it says
<your-username>, you should see the username from your GitHub account.
Next, cd into your new cloned directory, intro-to-javascript-functions-lab:
cd intro-to-javascript-functions-lab
Then, create an app.js and an index.html file. These files will hold your work for this lab:
touch app.js index.html
With the files created, open the contents of the directory in VS Code:
code .
Open the index.html file and add HTML boilerplate. Then link the app.js file by adding this line inside the <head> tag:
<script defer src="./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
nodeto execute theapp.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.