Tell us what’s happening:
i know the solution but i do not understand why does the constructor gets overwritten? i mean adding functions to class Dog
should not overwrite class type! besides; how does a function have a constructor? i know that i am thinking with the conceptual mind of other programming languages but a function is a function and a class is the only thing that has a constructor so how come a class is the same as a function here!
Your code so far
function Dog(name) {
this.name = name;
}
// Only change code below this line
Dog.prototype = {
constructor: Dog;
numLegs: 4,
eat: function() {
console.log("nom nom nom");
},
describe: function() {
console.log("My name is " + this.name);
}
};
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: Remember to Set the Constructor Property when Changing the Prototype
Link to the challenge: