Hello this is dog


#1

function Dog (breed) {
    this.breed = breed;
};

// add the sayHello method to the Dog class 
// so all dogs now can say hello
var Dog.prototype.sayHello = function() {
  console.log("Hello this a " + this.breed + "dog");
};

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

var myDog = new Dog("dachshund");
myDog.sayHello();
    
Why isn't this working?

#2

you need a space between " and d :slight_smile:


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.