I don’t understand why I get
“Dog should have the bark() method as an own property.”
I added .bark method directly to the object, doesn’t that make it it’s own property?
Your code so far
function Animal() { }
Animal.prototype.eat = function() { console.log("nom nom nom"); };
function Dog() {
this.bark = ()=> console.log("Woof!")
}
// Only change code below this line
Dog.prototype = Object.create(Animal.prototype)
Dog.prototype.constructor = Dog
// Only change code above this line
let beagle = new Dog();
console.log(beagle.bark())
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36.
I get that but previously in the course, when something was defined using prototypes outside the original object, it was saying that it isn’t an “own” type of property