Hi,
I'm trying to learn programming in JavaScript.
I installed node and VScode.
I created a simple js file and trying to run it via node.
When I execute the file in the terminal it works but I would rather use the "Run and Debug" button in VScode to also get the posibility to step by step debug.
But when press "Run and Debug" it shows this and not the result/output of my code:
https://imgur.com/a/rtfWBDH
Any ideas how to run my code via VScode?
Videos
For example, instead of typing this into the terminal:
node HelloWorld.js
how can I get the code to run as:
HelloWorld
I am surprised this has not been mentioned yet:
Simply open the .js file in question in VS Code, switch to the 'Debug Console' tab, hit the debug button in the left nav bar, and click the run icon (play button)!
Requires nodejs to be installed!
This is the quickest way for you in my opinion;
- Open integrated terminal on visual studio code (
View > Integrated Terminal) - type
'node filename.js' - press enter
note: node setup required. (if you have a homebrew just type 'brew install node' on terminal)
note 2: homebrew and node highly recommended if you don't have already.
have a nice day.
For example, instead of typing this into the terminal:
node HelloWorld.js
how can I get the code to run as:
HelloWorld
I just downloaded Visual Studio Code, but I don’t know how to run the source file.
Most websites online recommend executing a JS file via 'node myfile.js' in visual studio code.
Is there a simple extension (e.g. without browser) where I can execute JS code line by line? Like a jupyter notebook, mark code then press CTR/Shift-enter to execute selected lines?