Need Help with this JavaScript Code [SOLVED]

I did what the question asked and defined everything but it still wont let me pass, Why?

My code so far


Dog.prototype = {
constructor: Dog, // Solution

numLegs: 2,
eat: function() {
  console.log("nom nom nom");
},
describe: function() {
  console.log("My name is " + this.name);
}
};

My browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.105 Safari/537.36.

Challenge: Remember to Set the Constructor Property when Changing the Prototype

Link to the challenge:

Looks good to me, when I run your code it passes.

Maybe you removed the top lines of code for this challenge?

function Dog(name) {
  this.name = name;
}

Maybe let me check , if it works

Yes!!! Thank You! It Worked!

I would be useful if you include the console log here in the post.

If that’s all that is written, then you’re adding a prototype to an undefined function.

To make it work, define the Dog constructor function.


For next challenges, remember you can reset the code, using Reset All Code button.

1 Like

Thaks but I finished it by the help of @Erma32