Code is executing but an error message is showing up


#1
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 ' + [breed] + ' dog');
    };

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

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

what's wrong with those code, please help, it's actually executing, but the console is giving me this error message :

" ReferenceError: breed is not defined "

why is that?


#2

That function has no such variable. Perhaps the object has an attribute by that name?