In order to easily evaluate your answers, you will need a node
environment. We could use the browser, as I did during the lecture, but it would be easier to manage if there was a way to do this in VS Code. There is! ๐คฏ
You can toggle the terminal window in VS Code with the following keyboard shortcut:
[ctrl + j]
on Windows[cmd + j]
on Mac
This will open an instance of the terminal.
There are 2 ways to evaluate your JS using Node:
- Type
node
in the terminal, and hitenter
.
This will turn that terminal into a Node environment for you to play with.
You can type JavaScript in the same way I did while using the Browser console.
To exit/quit Node and get back to the terminal, do [ctrl + c]
twice.
To run your exercise files, you will need to type the following command at the terminal prompt:
node <PATH TO FILE>
The easiest way to do this is to type node
, hit [space] and then drag the file you want to evaluate into the terminal. This will place the path into the command line.
Alternatively, you can navigate to the right folder using cd
and then you could type node <FILE_NAME>
.