Hello everyone,

On today’s post, I’ll be teaching you guys the baby steps of Node JS Programming.

Lets write a script to print ‘Hello World’ in Console as our first script.There are so many IDE’s which are support Node.JS. My favorite is Sublime. Don’t worry you can even use notepad to get this job done.

Create a text file with you preferred name and with ‘.JS’ extension(eg: hello.js). This is your executable file and we are going to do the coding on top of this. Open the document (Right Click -> Edit) and type this simple text on it.

console.log('Hello World My Name Is Chamindu');

Now open Command Prompt and go to you directory where you saved .JS file. In my case it’s desktop. (To Redirect on CMD use cd <location> (cd Desktop))

It’s time to execute our first Node script. To do that type node <filename> on the console.

node hello.js

1.PNG

Done & Dusted 🙂

OK lets try to to read a file from your computer and print the content of it on console. Is it sound difficult ? Lets find out.

Create another project called ReadMyText.js and open it and start typing the magic words.

TO BE CONTINUED.

Advertisements