How do I run JavaScript code in Visual Studio Code? I want to run console.log('Hello, World!);
, but I don't know how. Do I need to install an extension?
Asked
Active
Viewed 5,887 times
0

galdeeb-dev
- 87
- 1
- 2
- 6
-
2What kind of environment are you trying to run it in? Is it browser-based or node? – Liftoff Mar 03 '21 at 06:45
-
Maybe Node, I'm not using a browser. – galdeeb-dev Mar 03 '21 at 06:48
4 Answers
1
You can install node.js first.
Then run the terminal in vscode with the command: node namefile

ohfufu
- 138
- 6
0
You can see the log
in the browser just press F12
in the browser and select console you will be able the see log
details there.

iamdhavalparmar
- 1,090
- 6
- 23
0
You can use vscode extension Code Runner https://marketplace.visualstudio.com/items?itemName=formulahendry.code-runner

Prakash Saripaka
- 292
- 1
- 5
0
you need to install NodeJS. You can install it from here: https://nodejs.org/en/
Create a new folder and open it in VS Code. then write the javascript code and name it with extension .js After completing the code save the changes that you made
Open the terminal in VS Code. and make sure you are in your project folder (cd yourproject)
finally run this command: node yourjsfilename

Babak Yaghoobi
- 1,892
- 9
- 18