Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

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?

3 Answers

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!

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...