It's time to check that Node.js works fine! We are going to write a very small program to begin with, which merely displays a message in the console. This will be an opportunity to see how the execution of .js files works with Node.js.
console.log('Welcome to Node.js!');
Save your file as .js extension. For example test.js.
Next, open a console in the folder where your test.js file is located and enter the command :
You should have the following result in the console:
Congratulations, you have created your very first Node.js program!
Well, that was really easy. We have simply tryed to write a message in the console.
You have seen that to launch a Node.js program you only need to specify the name of the .js file to execute. You know everything you need for the moment!
In later chapters we will deal with serious things in node.js