3

I have been using Pycharm for Python and now also learning Javascript in vscode. However, every time I try to output something with console.log after running it using the extension Code Runner, there is no output in the output window? Am I doing something wrong? When I hit run or play in Pycharm, it runs Python code step by step and shows me each line's output and results.. but for Javasript in vscode, there is no output? I put a very simple line below wondering if someone can guide me a bit. Thank you!!

var sum = 3;
console.log(sum);
Rob
  • 14,746
  • 28
  • 47
  • 65
Jason Todd
  • 181
  • 2
  • 10
  • 1
    Did you save the file? – Namaskar Dec 09 '19 at 02:48
  • Apparently I'm dumb.. i didn't save after everytime...yikes LOL got so happy starting this and forgot the even basic thing of "saving" before running... – Jason Todd Dec 09 '19 at 02:48
  • No worries, :) I did the same thing testing this, and also scratched my head when at first it didn't run. – Namaskar Dec 09 '19 at 02:50
  • haha i bet i made it seem like a huge mystery at first.. but then.. a big yikes.. beginner coding error.. wondering how many errors i'll make on this journey.. sorry, business major trying to convert to a programmer T_T – Jason Todd Dec 09 '19 at 02:55

5 Answers5

1

Follow these steps:

  1. Save the file.
  2. Press ctrl+alt+N or right click and select run.
Himanshu Singh
  • 2,117
  • 1
  • 5
  • 15
1

I think you forgot to save the file. First save the file then execute it.

Kundan
  • 1,754
  • 16
  • 37
0

You don't need an extension to debug NodeJS in Visual Studio Code. Pressing F5 in a .js file will start the debugger. Create breakpoints by clicking to the left of the line number or press F9.

Namaskar
  • 2,114
  • 1
  • 15
  • 29
0

JS at VS Code by console.log() send output at Debug Console window. You can access Debug Console window with shortcut Ctrl+Shift+Y

-1

You can type node then the name of your js file and you should see an output.

Example file name is my myfile.js So In vscode type node myfile.js just makes sure you have node install

appdesigns
  • 114
  • 1
  • 11