Create a Method on an Object (punctuation?)

Tell us what’s happening:

Your code so far


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

dog.sayLegs();

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/object-oriented-programming/create-a-method-on-an-object

Your sayLegs function returns the string “This dog has 4 legs.4.” instead of “This dog has 4 legs.”

1 Like