JavaScript Object-Oriented JavaScript Working with Classes in JavaScript Instantiating a Pet Object

Hanna Zeif
Hanna Zeif
11,213 Points

Nothing 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);

1 Answer

I copied your code and pasted it into the workspace, it looks like it is working fine: link to image