This source code works ; but why "breed" are not defined?


#1

function Dog (breed) {
this.breed = breed;
};
Dog.prototype.sayHello = function () {
console.log("Hello this is a " +[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();


#2

Hi this part

console.log("Hello this is a " +[breed] + " dog" );
}

Instead of [breed] try to use this.breed