How to Install JavaScript in Visual Studio Code on Windows 11

Visual Studio Code (VS Code) is one of the most popular code editors for web developers. It’s fast, lightweight, and has built-in support for JavaScript, which means you can start coding right away without extra setup. However, to run and test JavaScript code directly from VS Code, you’ll need to install Node.js and configure your environment properly.

In this guide, we’ll walk through how to set up JavaScript in VS Code on a Windows computer step-by-step.

What You’ll Need

Before getting started, make sure you have:

  • A Windows 10 or Windows 11 computer
  • A stable internet connection
  • The latest version of Visual Studio Code installed
  • Administrator access to install Node.js

If you don’t have VS Code installed yet, download it from the official VS Code website and complete the setup.

Step 1: Install Node.js

Although VS Code can edit JavaScript files by default, you need Node.js to execute JavaScript code outside the browser.

  1. Go to the Node.js official website.
  2. Download the LTS (Long-Term Support) version for Windows.
  3. Run the installer and follow the on-screen instructions.
  4. Make sure to check the box that says “Add to PATH” during installation.

Once the installation is complete, open Command Prompt or PowerShell and verify that Node.js and npm (Node Package Manager) are installed correctly:

node -v
npm -v

If both commands return version numbers, Node.js is installed successfully.

Step 2: Install Visual Studio Code (if you haven’t already)

If VS Code isn’t installed on your computer yet, download it from the Visual Studio Code website and install it using the default options.

Once installed, open it from the Start menu or by typing code in the terminal (after restarting your system).

Step 3: Create a JavaScript Project Folder

You’ll now create a folder for your JavaScript project.

  1. Open VS Code.
  2. Click on File > Open Folder and create a new folder (for example, JavaScriptDemo).
  3. Inside that folder, create a new file named app.js.

This file will contain your JavaScript code.

Step 4: Write Your First JavaScript Code

Open the newly created app.js file and type the following code:

console.log("Hello, JavaScript in VS Code!");

Save the file using Ctrl + S (or Cmd + S on macOS).

Step 5: Run JavaScript Code in VS Code Terminal

To execute your JavaScript file, you’ll use the built-in terminal in VS Code.

  1. Open the terminal by selecting View > Terminal from the menu bar.
  2. Make sure the terminal path points to your project folder.
  3. Type the following command and press Enter:
node app.js

If everything is set up correctly, you’ll see the output:

Hello, JavaScript in VS Code!

Congratulations — you just ran JavaScript directly inside VS Code.

Step 6: (Optional) Install Code Runner Extension

If you prefer running JavaScript code with a single click, you can install the Code Runner extension.

  1. In VS Code, go to the Extensions view by clicking the square icon on the sidebar or pressing Ctrl + Shift + X.
  2. Search for Code Runner.
  3. Click Install.

After installation, you can run your code by clicking the Run Code button at the top right or using the shortcut Ctrl + Alt + N.
The output will appear in the terminal or the Output panel.

Step 7: Enable IntelliSense and Formatting (Optional)

VS Code already includes IntelliSense for JavaScript, which provides autocompletion and real-time hints. However, you can enhance it further by installing additional extensions:

  • ESLint – for catching syntax errors and enforcing code style.
  • Prettier – for automatic code formatting.

You can install these from the Extensions view the same way as Code Runner.

Wrapping Up

Setting up JavaScript in VS Code is straightforward. The editor already includes built-in support for JavaScript syntax, and with Node.js installed, you can write, run, and debug scripts all in one place.

Once your environment is ready, you can move on to building real-world projects — from small scripts to complete web applications using frameworks like React, Vue, or Express.js.

Posted by Arpita

With a background in Computer Science, she is passionate about sharing practical programming tips and tech know-how. From writing clean code to solving everyday tech problems, she breaks down complex topics into approachable guides that help others learn and grow.