14. Prototype to the Rescue


#1

wondering if I can write
Dog.bark = function ()... without prototype? if it works, what would be the difference? Thanks.

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();


#2

hey there sir. remove the *'s from the code and it should run as it. I solved a similar code before with this same kind of coding. I believe(not sure at all) that the * mark in coding doesnt serve a real purpose unless you're doing math. so yeah look into that for me.