I think I found an error in Object Oriented Programming: Create a Method on an Object

return "This dog has "

vs

return “This dog has”

the top answer was correct, the bottom answer with the quotes and no space is incorrect.

I hope this helps

We don’t have enough information and context. Can you post your full code and a link to the challenge you are talking about please?

the top is correct (but I think it may be wrong)

  numLegs: 4,
  sayLegs: function() {
    return "This dog has " + dog.numLegs + " legs.";
  }
};

dog.sayLegs();

VS

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

dog.sayLegs();

Sure and thanks for getting back to me so quickly

In your code above, the first one will return
“This dog has 4 legs.”
The second one will return
“This dog has4 legs.”

I’m not sure which one you are saying passes the tests. I don’t have a link to this challenge, so I can’t test it.

2 Likes

Ah gotcha, alright, that makes more sense alright got it

1 Like