Object Oriented Programming - Add Methods After Inheritance

Tell us what’s happening:
Describe your issue in detail here.
Please, I do not know why my code is not passing the test. it keeps telling me: beagle.eat() should log the string “nom nom nom”
beagle.bark() should log the string “Woof!”

Your code so far

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!");
};


// Only change code above this line

let beagle = new Dog();
beagle.eat();
beagle.bark();

Your browser information:

User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0

Challenge: Object Oriented Programming - Add Methods After Inheritance

Link to the challenge:

Thank you, but I have done that several times… i even did it right now and it isn’t working

I changed my browser from Firefox to Chrome and it passed. Thank you so much!!!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.