Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

JavaScript Object-Oriented JavaScript Object Basics Dot Notation & Bracket Notation

How do you open console in VSCode?

I want to avoid the workspaces to be consistent from class to production. help?

2 Answers

Go to the Terminal menu in VS Code and click "New Terminal"

In the video... the instructor has a console open... not a terminal. How do I recreate that in VScode... to console.log? Can you console.log to terminal? it didn't work for me. Because it's a JS file, my browser won't open it. I am missing something...

Hi Amy, if you have node on your computer you could console.log in the terminal on VS code by typing node and then the js file: node script.js. The other way to accomplish this is to create an html file, and then reference your js file in your html file. I just created a basic index.html file and a practice.js file:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script src="practice.js"></script>
</body>
</html>

In the practice.js file I typed console.log('hello world'); Next I left clicked on index.html and chose copy path. Paste that into your browser (preferably Chrome) and you will get a path to your index.html file. Next open Dev Tools (cmd + option + i for Mac) and click on console. There you should see Hello World. Let me know if you have any further problems!