28/30 Hello? Yes, This is Dog (Says "SyntaxError: missing ) after argument list"


#1

I keep getting "SyntaxError: missing ) after argument list" error.

Here is my code, I can't find where there is a missing ')' Can anyone help?

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

Hi @bdemaloney

If it may help please see the code example below. In short you are missing the second concatenation syntax reference "+", after this.breed. Go ahead and add that in and see if that works out.

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") //missing second concatenation
};

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

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

#3

That was it... Thank you.