How To Run JavaScript in Visual Studio Code on Windows 10

JavaScript is a very popular programming language, and there are many frameworks already released for JavaScript developers to ease their JavaScript programming journey. So in this article let’s find out how you can run JavaScript in visual studio code.

 

Video Tutorial: Run Javascript in Visual Studio Code

If you’re still finding it hard installing JavaScript on your Windows 10 machine then you can refer to the below video for a complete guide.

 

 

Step 1: Download & Install Node.js

1) Firstly we’ll have to download the latest version of Nodejs available on the internet. Follow the below-provided download link and you’ll be redirected to the official Nodejs downloads page. Now based on your system architecture click on the appropriate button and your download will start. In our case, it’s “64 bit“.

Download Node.js Here: https://nodejs.org/en/download/

 

node.js website

 

2) After the downloads get finished open it in the folder where it has been downloaded and simply double click on the downloaded file to start the Nodejs installation wizard.

 

nodejs exe file

 

3) A setup wizard will appear in the window screen, so here click next.

 

nodejs setup

 

4) Now you’ll be asked to accept the license agreement, so simple tick the “I accept the terms in the license agreement” box and click next.

 

nodejs setup

 

5) The installation wizard will now ask you to select the installation path for Nodejs. Here we will go with the default installation path so simply click next.

 

nodejs setup

 

6) A custom setup window will appear so here as well no need to change anything simply click next.

 

nodejs setup

 

7) A Ready To Install Nodejs window will appear so simply click on the install button and Nodejs will start getting installed in your system.

 

nodejs setup

 

8) Once installation gets complete click on the finish button. By this time Nodejs is successfully installed in your system. So if you see something similar to the below image then congrats 👍👍 you’ve nailed the installation process.

 

nodejs setup

 

Step 2: Verify Node.js & Npm Version

 

1) Open your command prompt by searching “cmd” and pressing enter in the windows search menu.

 

verify nodejs

 

2) In the command prompt type 

node --version

 to check the installed version of Nodejs.

 

verify nodejs

 

3) Now type

npm --version

 to check the installed version of the node package manager.

 

verify npm

 

Step 3: Setup Visual Studio Code for JavaScript 

 

1) Open vs code and click on the extensions button. There in the search box type “JavaScript es6“, click on the first option provided by charalampos karypidis and install it by clicking on the install button.

This extension will install JavaScript code snippets in es6 syntax

 

JavaScript es6

 

2) Now again search for “code runner” and select the first option provided by Jun Han and install it in the same way described above.

 

code runner extension

 

3) Create a New File in vs code by simply clicking “Ctrl+N“.

 

new file in vscode

 

4) Save this newly created file by the name “subscribe.js“.

Make sure to add the “.js” extension to a JavaScript program while saving otherwise visual studio code will not be able to identify the program as a JavaScript program.

 

save file in vscode

 

5) Paste the below-provided code snippet in the vs code and press “Ctrl+S“. And click on the small play button to run your JavaScript program.

 

console.log("subscribe!");

 

 

 

run javascript in visual studio code

 

 

6) If you see something like the image below then congrats you’ve successfully executed your first JavaScript program.

 

javascript output

 

 

Congrats you’ve successfully executed JavaScript code in windows 10✌️✌️.

Also Read: How To Install Visual Studio Code in Windows 10

Ethix

I'm a coding geek interested in cyberspace who loves to write and read

One thought on “How To Run JavaScript in Visual Studio Code on Windows 10

  • July 8, 2021 at 11:16 AM
    Permalink

    To the point. No bullshit.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *