Instead of commented why this don't work

Tell us what’s happening:

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!");
// };
Dog.prototype={
constructor:Dog,
bark(){
    console.log("Woof!");
}
}


// Only change code above this line

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.66 Safari/537.36.

Challenge: Add Methods After Inheritance

Link to the challenge:

Oh,I got to know why in next lesson it’s getting override