25. Constructors in review


#1

Hi,

My code below passes the exercise, yet it does not print the three required statements to the console. Is this a bug, or is there something missing from my code?

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
rabbit1 = new Rabbit("fluffy");
rabbit2 = new Rabbit("happy");
rabbit3 = new Rabbit("sleepy");

rabbit1.describeMyself;
rabbit2.describeMyself;
rabbit1.describeMyself;

#2

Hello!

Your code seems correct. Except for the part of calling the functions.

rabbit1.describeMyself;
rabbit2.describeMyself;
rabbit1.describeMyself;

You're supposed to call a function like this: function();
So the correct would be:

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

Also the numbers were wrong.

Try it and see if it works. :smile:


#3

thanks @srtabebrito!