1

I want to test small snippets of JavaScript code in VSCode's terminal before inserting them in my project. I want something similar to Chrome's Devtools console.

Heretic Monkey
  • 11,687
  • 7
  • 53
  • 122
Strategy Thinker
  • 343
  • 1
  • 3
  • 15

3 Answers3

6

Install node and npm from https://nodejs.org/en/download/

After installation in VSCode under terminal tab run node Paste your snippet to run your javascript code or use node filepath/filename.js to see result.

Hunter
  • 129
  • 5
4

Just run the command node to enter a node environment where you can run arbitrary JavaScript.

Ian
  • 5,704
  • 6
  • 40
  • 72
0

Run node in the VSC console and you will have the same experience

crtag
  • 2,018
  • 2
  • 14
  • 13