15/30 Prototype practice


#1


https://www.codecademy.com/courses/objects-ii/2/5?curriculum_id=506324b3a7dffd00020bf661#


I dont think I'm missing anything.
The error is:Oops, try again. There was a problem with your syntax.

Replace this line with your code. 
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
var Cat.prototype.meow = function() {
console.log("Meow!");  
};

// add code here to make the cats meow!
chesire.meow();
gary.meow();


#2

You don't need a var call for your Cat.prototype.meow = function() {.


#3

Thanks for your prompt reply!:slight_smile:


#4

Wait but now it says "Oops, try again. It looks like you have an error in your code. Here's the message: ReferenceError: chesire is not defined" when i delete var.


#5

Make sure you spell cheshire correct. Check your second last line of your code.


#6

oh i spelled cheshire wrong thanks for your help!


#7

Haha no problem! Have a nice day :slight_smile:


#8

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.