Console.log in vs code

Hello everybody,

I have ran across a weird error with vs code saying that console.log is not recognized as a term (There is a picture below). I have searched through the vs code documentation, stack overflow, and scanned Google and YouTube and have found nothing related to my problem. Do you guys have any idea of what is going on?

Also, on an unrelated topic, I found a neat video about everything that you can do with the console command (actually that is when I noticed the problem lol :laughing: ) Beyond Console Log in 100 Seconds - YouTube

So, you’re trying to run “console.log” in you terminal? But that is not a terminal command. That is JavaScript. You can use it in your JS code or in the JS console in your dev tools. It doesn’t mean anything in the terminal, afaik.

I thought that where it goes since previously when I ran console.logs that is where it ended up

The output of the console.log may end up there, but that is not where you use it. console (in this case) is a JS module with a method log (among others) that will output data to your console. On a web page that is going to be your dev tools console, but if you are in a web env it may be your terminal window.

By the way, you can run JS from the terminal command line by installing nodeJS. You put your JS in a file and then you can run it with

node file.js

I would also suggest checking out the Quokka.js VS Code extension. It runs NodeJS, so no browser API stuff. But it’s very handy.

Okay, thanks @kevinSmith for your help and clarification.

Also, thanks @bbsmooth and @lasjorg , I’ll look intom the node.js cmd line, and I have been looking into Quokka and it looks like you can’t do anything unless you pay for the Pro version.

Sure you can, I use it all the time. There wouldn’t be much point in having a community edition if it didn’t do anything.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.