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


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");

var myDog = new Dog("dachshund");


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


Instead of commas use + signs here.


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


Thank you! I never would have caught that