Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function Dog (breed) {
- this.breed = breed;
- };
- // here we make buddy and teach him how to bark
- var buddy = new Dog("golden Retriever");
- Dog.prototype.bark = function() {
- console.log("Woof");
- };
- buddy.bark();
- // here we make snoopy
- var snoopy = new Dog("Beagle");
- /// this time it works!
- snoopy.bark();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement