25/33


#1

So I have bits of code that I have constructed. I am confused however on why it wont let me pass the lesson. It says adjective is undefined
Here is 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
var rabbit1 = new adjective('fluffy');
var rabbit2 = new adjective('happy');
var rabbit3 = new adjective('sleepy');

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

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

Do you see the main difference here is that you are supposed to be created Rabbits and not adjectives. The point of this exercise is that you are creating Rabbits with an adjective as a parameter. So when you are creating rabbit1,rabbit2,rabbit3, they all have to be made with the constructor, "new Rabbit(adjective)".

Does that make sense?


#8

Yes! Thank you! And to all the other people who responded. All of this helped. And I get that the rabbit is being described and used as a parameter :smile: