Object orientated programming: create a method on an object

Object orientated programming: create a method on an object
0

Hi, I have looked at previous queries about this challenge on the forum. I am stuck and cannot find the right solution. Can someone tell me where I am going wrong?

let dog = {
  name: "Spot",
  numLegs: 4,
  sayLegs: function() {return "This dog has" + dog.numLegs + "legs."};
};
dog.sayLegs();
// Returns "This dog has 4 legs."

Your code is almost correct. But there is an unnecessary character. By deleting this intruder character your code will work.

Another detail: insert a space here: has " " legs.

Your code is returning This dog has4legs.

1 Like

Thank you for your help…

I get what you’re saying, now that I see where I was going wrong.
Thank you for your help…