Before we get started, let’s install Node.js. Installing Node.js isn’t very hard actually. You can install Node.js on Windows, Mac and Linux. As of this tutorial, we’ll be installing v0.10.29. However, you can install any version above 0.10.
You can download the installers here! Once you download the installer, then you can just run the installer and install Node.js like any other application. It’s really that simple! You do not have to tweak the default installation settings. The default settings will suffice for this tutorial series. Now, you may be wondering, what exactly is being installed?
You may have already noticed, but you’ll have a program called Node.js. Launch this application and you should see something similar to the image below.
var foo = 5; console.log( foo );
You should see the following outputted onto your console.
Nothing special here. We just create a variable named foo then output it onto the console. You’ll notice that after the output we get undefined outputted as well. You’re doing nothing wrong. The Node.js Console will also output the return value of a function.
So, what is the use of the console?
It’s used mainly for debugging your scripts. To be honest, we won’t be using it at all in this tutorial series. This console just comes with your installation of Node.js just in case you wanted to run some code really quick without having to restart your application. You won’t find yourself using it that often either. However, it’s still nice to know what else the console can do. If you were to start writing blocks of code instead of single lines of code, then you’ll start seeing dots in the console. Like so:
The point of this tutorial was to install Node.js and introduce you to the console. While the console is something we won’t be using at all, it’s still nice to know about it. In the next tutorial, we’ll learn another thing or 2 about Node.js and then I promise we’ll start building real world web applications.