Intro to Objects II,28. what the heck is wrong?


#1


https://www.codecademy.com/courses/objects-ii/5/2?curriculum_id=506324b3a7dffd00020bf661#


This is my code, I have debugged it to helll and I can't tell what is wrong.


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

// add the sayHello method to the Dog class 
// so all dogs now can say hello
Dog.prototype.sayHello = function() {
        console.log("Hello this is a ", this.breed, " dog");
};

var yourDog = new Dog("golden retriever");
yourDog.sayHello();

var myDog = new Dog("dachshund");
myDog.sayHello();


#2

This post was flagged by the community and is temporarily hidden.


#3

Instead of commas use + signs here.


#4

to many spaces here:

console.log("Hello this is a ", this.breed, " dog");

using , will include a space. So now you have two spaces. either do:

console.log("Hello this is a", this.breed, "dog");

or use + to concate the string, in which case you need to add a space after a and before dog


#5

Thank you! I never would have caught that