What is wrong here?
function Dog (breed) {
this.breed = breed;
};
Dog.prototype.sayHello = function () {
console.log(“Hello, this is a” + " " + this.breed +" " + “dog”)
};
// add the sayHello method to the Dog class
// so all dogs now can say hello
var yourDog = new Dog(“golden retriever”);
yourDog.sayHello();
var myDog = new Dog(“dachshund”);
myDog.sayHello();
And this is logged in the console:

1 Like
I think its the comma after hello in your dog prototype function
1 Like
Haha, omg your right! Thanks so much! 
1 Like
I have the same problem. Nothing shows in the console log
Try putting spaces on both sides of the “+” signs
1 Like
I had an problem with my code, took me a while to find, but I found it and fixed it.
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();
do you see what i did wrong?
on this part I wrote dog
instead of Dog
.
dog.prototype.sayHello = function(){
console.log('Hello this is a ' + this.breed + ' dog');
};
this is how it should look:
Dog.prototype.sayHello = function(){
console.log('Hello this is a ' + this.breed + ' dog');
};
anyways, just thought i’d post in case someone else has the same thing happen.