November 21, 2017
In this first tutorial, you will learn how to set up your computer environment for a successful beginning to your programming journey.
For now, download and install VS Code onto your system and we can proceed.
The main view in VS Code will be where you can write all of your code that we’ll be learning. The interface is fairly basic, with your current workspace open on the left (don’t worry that your screen doesn’t look quite like mine, I’ll cover that in the VS Code tutorial). You can create a new file with:
File -> New File
nodeto test and see if Node has been installed properly. You should see a ’>’ character that you can type next to. This is Node’s interactive environment that we can cover in another lesson. For now, as long as it comes up we know that things are working.
ctrl+dto exit out of Node
cdcommand to move to the directory you saved your new file in.
console.log('Hello World!')into your .js file.
I prefer the flexibility of working with things directly in an editor on my computer, but there is an easy alternative to setting all of this up. There are a few websites out there that let you write JS code and run it directly in your browser. These environments also provide you with the entire Node ecosystem so you can include any third party Node JS library out there to test out (we’ll go over these in a future less on). Let’s take a look at a few of the sites available at the time of writing this article:
Runkit.com is a website that creates a virtual server for you to test out Node JS code. It also lets you actually download your code if you’d like to as well. One thing that Runkit does which seems to be unique is it will interpret the outputted data and attempt to present it in a way that makes the most sense. In the screenshot, you can see it displaying a set of coordinates on an actual Google Map.
KataCoda is nice since it provides an actual terminal for you to test out command line commands along with your coding. The terminal is a Bash terminal, which is one of the standard types of terminals that Linux uses so it might be different from your local terminal. It still is a nice addition that can give you so more experience and exposure to a new technology.
cd (change directory) to move between directories. The directory that you’re currently in is by default shown to the left of your cursor. You can use the cd command as such:
cd Documents where “Documents” is the directory to change to. Using