I have a question on the syntax of this challenge.
I dont understand why the first Dog.prototype works but the second doesnt
Dog.prototype.bark = function() {
console.log("Woof!");
};
Dog.prototype = {
bark: function() {
console.log("Woof!");
}
};
**Your code so far**
```javascript
function Animal() { }
Animal.prototype.eat = function() { console.log("nom nom nom"); };
function Dog() { }
// Only change code below this line
Dog.prototype = Object.create(Animal.prototype);
Dog.prototype.constructor = Dog
/*Dog.prototype.bark = function() {
console.log("Woof!");
}; */
Dog.prototype = {
bark: function() {
console.log("Woof!");
}
};
// Only change code above this line
let beagle = new Dog();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Challenge: Object Oriented Programming - Add Methods After Inheritance
Link to the challenge: