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
nazareth kohl
1,223 Pointsoojs.html file: Why won't it work?
So, I have the oojs.html file with the empty script tag, and I put const person = {}; in it, saved the file, brought Visual Studios back up, entered person into my Javascript tab, and then pressed enter, but nothing came up. Did I do everything right? What's wrong?
1 Answer
Laura Coronel
Treehouse TeacherHi nazareth kohl ,
Thanks for reaching out! I’m happy to help with both questions.
1. Using the JavaScript console
It sounds like you’re on the right track! The JavaScript console is a tool built into your browser that lets you run JavaScript commands and see their results. You’ll want to use the console in your browser (such as Chrome), rather than the JavaScript tab in Visual Studio Code.
Here’s how the exercise should work:
- In your
oojs.htmlfile, make sure you haveconst person = {};between the opening<script>and closing</script>tags, as you’ve done. - Save the file and open or refresh it in your browser.
- Open your browser’s Developer Tools and select the Console tab. In Chrome, you can usually do this by right-clicking the page, selecting Inspect, and then clicking Console.
- Type
personinto the console and press Enter.
You should see something representing an empty object, such as Object {} or {}. That's expected! The exercise is simply showing you how to create an object and inspect it in the console. You haven't done anything wrong.
2. Accessing Chapter 2
If the Resume Course button isn't working, you can access Chapter 2 directly using this link:
https://teamtreehouse.com/library/upi-chapter-2-integration-of-javascript-with-html
Once you open the page, scroll down to see the list of steps in the chapter. You should be able to click on any step to access it.
I hope this helps!
nazareth kohl
1,223 Pointsnazareth kohl
1,223 PointsThis is for the 'Introduction to Javascript' Course, by the way.