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 trialHanna Zeif
11,309 PointsNothing happens
My code looks identical to what's on the screen but it's not doing anything. When I type "node Pet.js into the console it just gives me another line in the console, no output. Here's my code:
class Pet { constructor(animal, age, breed) { this.animal = animal; this.age = age; this.breed = breed; } }
const ernie = new Pet('dog', 1, 'pug');
const vera = new Pet('dog', 8, 'border collie');
console.log(ernie);
4 Answers
damon5
11,405 PointsI was having this same problem because I wasn't paying attention when she added the console.log(ernie) portion and the view later is scrolled up. :)
Jane Anaekwe
2,531 PointsMake sure to save the Pet.js document (command S or control S). It might just be you haven't saved the recent changes you just added then nothing happens because nothing has been saved yet.
Marcos Velasco
3,298 PointsI would recommend installing node.js and using Visual Studio code since you would have to use it in the future anyways.
allenh
10,849 PointsI copied your code and pasted it into the workspace, it looks like it is working fine: link to image