Hello World in Nodejs

In this Nodejs tutorial, we will create a simple Application to display the output “Hello World!” in the command prompt.

NODEJS “HELLO WORLD” CODE TO RUN ON THE COMMAND LINE.

var msg = 'Hello World!'; 

console.log(msg);

Console: It is a global module that provides a simple debugging console that is similar to the one javascript console in web browsers.
Msg is the parameter that is passed to the log method.
Now you can run the above code by running this line on the command line of a terminal or command prompt. (In case you are running on the command line).

node app.js 

THE FOLLOWING RESULT

The node command executes the JavaScript file.
It is not necessary to specify the file extension because it’s not mandatory.
AFTER THAT YOU WILL GET :
Hello World !”

Leave a Reply

Shopping cart