25. Constructors in Review


#1

Hi guys,

So I've passed this lesson already or at least the system did. But I haven't managed to print out anything? I've read in other threads that if I console.log each individual rabbit (1-3), I'll get undefined because there's already an initial console.log command. But right now, that initial command doesn't seem to print anything.

How do I go about printing each individual rabbit and the new adjectives?

function Rabbit(adjective) {
    this.adjective = adjective;
    this.describeMyself = function() {
        console.log("I am a " + this.adjective + " rabbit");
    };
}

// now we can easily make all of our rabbits
var rabbit1 = new Rabbit ("fluffy");
var rabbit2 = new Rabbit ("happy");
var rabbit3 = new Rabbit ("sleepy");

#2

Hi you have to use the method describeMyself to print them like that

rabbit1.describeMyself();
rabbit2.describeMyself();
rabbit3.describeMyself();

#3

Fantastic. That's what I needed - cheers :smiley: