Guest User

Breed Not Defined???

a guest
Dec 2nd, 2015
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. function Dog (breed) {
  2. this.breed = breed;
  3. };
  4.  
  5. // add the sayHello method to the Dog class
  6. // so all dogs now can say hello
  7. Dog.prototype.sayHello= function(){
  8. console.log("Hello this is a"+" "+breed+" "+"dog.")
  9. };
  10.  
  11. var yourDog = new Dog("golden retriever");
  12. yourDog.sayHello();
  13.  
  14. var myDog = new Dog("dachshund");
  15. myDog.sayHello();
Advertisement
Add Comment
Please, Sign In to add comment