How do you show the console log in Visual Studio Code with JavaScript?

I am just starting out on learning JavaScript and I made flashcards for the lessons that I have previously done. I wanted to open Visual Studio code and test myself. However unlike Codeacademys online terminal I can’t seem to figure out how to get console.log() to show up anywhere.

All I want to do is make sure that the code I am typing in is working correctly. I don’t want too be stuck using the Online terminal that CodeAcademy has for the lessons but I am frustrated beyond belief right now as I don’t know what to do. I am beginner so it is probably something simple but I can’t for the life of me figure it out.

6 Likes

Make sure you have node installed. Enable view of the Terminal and Debug Console (go to the View menu and select Terminal). You can press F5 for Debugging or Ctrl-F5 for Run without debugging. When you get a menu asking for environment, select Node.js. You should see output in the Debug Console.

Or you can type in the terminal window inside of VS Code (for example: node helloworld.js). Then you would get output in the Terminal window.

6 Likes

Thank you! This helped quite a bit!

2 Likes

Hello, I have the same problem but can’t seem to find a solution.

I wrote console.log(“hello”) in my JS file and i would like it to show “hello” in the debug console but nothing happens when i press F5. When you talk about node.js , you mean that i should download and instal this : Téléchargements | Node.js ?

Because I did and nothing happens still, i’m a bit lost here…

You must install the link you send and then open terminal and type ‘npm install node’, then press f5 select node.