Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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();
Advertisement
Add Comment
Please, Sign In to add comment