With Node, we now have a feature set that looks much more similar to other languages, such as Java, Python, or PHP. Some of these are as follows:
- You can manipulate your filesystem, creating and removing folders
- You can create query databases directly
- You can even create web servers using Node
These were things that were not possible in the past, and they are because of Node.
This means that I can run something like console.log, which, as you probably already know, logs a message to the screen. log is a function, so I'll call it as such, opening and closing my parentheses, and passing in a string inside two single quotes, a message Hello world!, as shown in the following command line:
This will print Hello world to the screen. If I hit enter, Hello world! prints just like you'd expect, as shown in the following code output:
If I open up the developer tools in Chrome by going to Settings | More Tools | Developer Tools:
I can ignore most of the things. I'm just looking for the Console tab, as shown in the following screenshot:
As you can see in the preceding screenshot, Hello world! prints to the screen, which is the exact same result we got when we ran it up earlier using Terminal. In both cases, we're running it through the V8 engine, and in both cases the output is the same.
Now, we already know that the two are different. Node has features such as filesystem manipulation, and the browser has features such as manipulating what's shown inside the window. Let's take a quick moment to explore their differences.