Please note that it is generally not good practice to name files starting with a number like 1-basics.js, this is just for convenient ordering in your file system of the examples.
Before attempting to run JavaScript files, please make sure you have followed the instructions on the Setting up Node.js guide on Notion.
Furthermore, please note that the JavaScript examples are stored in the examples and exercises directories, so trying to run a JavaScript file straight up by typing into the terminal node <filename>.js will not work.
If you are not in the examples directory, you will need to navigate to it using the Terminal and the cd (change directory) command.
# Note: ONLY TYPE THE STUFF TO THE RIGHT OF THE >
..\week4-examples-and-exercises> cd examples
..\week4-examples-and-exercises\examples> Suppose you are in the examples directory and want to navigate into the exercises directory. You can use cd .. to first go to the parent directory of examples and then cd into exercises as you would normally.
# Note: ONLY TYPE THE STUFF TO THE RIGHT OF THE >
..\week4-examples-and-exercises\examples> cd ..
..\week4-examples-and-exercises> cd exercises
..\week4-examples-and-exercises\exercises>Let's say that you are in the examples directory and want to run 1-basics.js. You can run 1-basics.js as follows:
# Note: ONLY TYPE THE STUFF TO THE RIGHT OF THE >
..\week4-examples-and-exercises\examples> node 1-basics.jsIf this doesn't work, you may be in the wrong directory or have not yet set up Node.js. You can also use TAB to autocomplete when typing in the file name.