0

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?

galdeeb-dev
  • 87
  • 1
  • 2
  • 6

4 Answers4

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

enter image description here

0
  1. you need to install NodeJS. You can install it from here: https://nodejs.org/en/

  2. 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

  3. Open the terminal in VS Code. and make sure you are in your project folder (cd yourproject)

  4. finally run this command: node yourjsfilename

Babak Yaghoobi
  • 1,892
  • 9
  • 18