How To Write and Run Your First Program in Node.js
Step 1: Create a new Node.js file and save named"console_first.js"
➤ File Name: console_first.js
console.log('Hello Node.js');
Step 2: Open Command prompt / Node.js command prompt interface, on your computer depends on the operating system. For Windows users : Click on the start button and look for "Command Prompt" or simply write "cmd" in the search field.
Now command prompt is open set your path, Here we have save "console_first.js" file on the desktop.
➤ Note: run the following code, For go to desktop
cd desktop
Step 3: After setting the path , run the following code
➤ Note: For display output
node console_first.js
This code you can run on the command prompt, as well as Node.js command prompt. You can show below output photos.
Comments