“There is one crucial side effect of manually setting the prototype to a new object. It erases the constructor
property!”
Why is this so important? What problems might follow if the constructor property is erased?
Your code so far
function Dog(name) {
this.name = name;
}
// Only change code below this line
Dog.prototype = {
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 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36
.
Challenge: Remember to Set the Constructor Property when Changing the Prototype
Link to the challenge: