Hello World with Node.js

Dhruv Rohatgi
Jan 7, 2021
First Node.js Code

Prerequisites:

Check out the previous post to come on track with us!

To implement your 1st node.js project, open the terminal in the project directory, and initialize your nodejs project with the following command:

npm init

The prompt will ask for some information, just press enter till you exit the setup process

Now create a file named helloWorld.js in the project directory and type the following line of code:

console.log(“Hello World!”);

Save the code and in the command prompt type:

node helloWorld.js

There you go! Here is your output on the terminal

Hello World output

--

--

Dhruv Rohatgi

Designer| Developer| Innovator| Founder at HelixSmartLabs Pvt. Ltd.