How to run your first NodeJS code in VS Code (Hello World)

Saul Goodman May 19, 2019 Loading...

This tutorial will show you how to run your first NodeJS code in VS Code.

Prerequisites

Node.js installed on your computer (you can download the setup file from the official website nodejs.org and just click “Next, next, next…” ).

Let’s start!

1. Open your VS Code, create a brand new js file and call this whatever you like. I will call it something like “hello.js”.

2. Add some code to say “Hello world!”:

console.log("Hello World!");

3. Create a new terminal by pressing “Ctrl + `” or selecting “Terminal > New Terminal” from the main menu. After that, type “node hello.js” if you are using Windows or “sudo node hello.js” if you are using Mac and see the result:

Related posts

avatar
Welcome to KINDACODE. Have a nice day and code well!