Exercise 15: Prototype Practice


#1

It appears that my code is not working. Error says that "meow" is not a function. It's correct, technically it's a method, but who's counting?

function Cat(name, breed) {
this.name = name;
this.breed = breed;
}

// let's make some cats!
var cheshire = new Cat("Cheshire Cat", "British Shorthair");
var gary = new Cat("Gary", "Domestic Shorthair");

// add a method "meow" to the Cat class that will allow
// all cats to print "Meow!" to the console
Cat.prototype.meow = function() {
console.log("Meow!");
}

// add code here to make the cats meow!
Cat.meow()


#2

Can I delete this?

Ugh...

Figured it out.

cheshire.meow()
gary.meow()