Constructors in Review, assigning adjectives


#1

Hi,
I'm supposed to follow the constructor and assign adjectives, I have followed the given code and put in what the exercise asks me too yet I still receive an error saying I haven't assigned any adjectives.
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
function rabbit1(adjective) {
this.adjective = "fluffy";
this.describeMyself = function() {
console.log("I am a " + this.adjctive + " rabbit");
}
};
function rabbit2(adjective) {
this.adjective = "happy";
this.describeMyself = function() {
console.log("I am a " + this.adjctive + " rabbit");
}
};
function rabbit3(adjective) {
this.adjective = "sleepy";
this.describeMyself = function() {
console.log("I am a " + this.adjctive + " rabbit");
}
};


#2

Read back over the concept of Constructors.You have made a constructor in the function Rabbit and now you use it to create new rabbits by passing in the adjectives "fluffy" , "happy" and "sleepy". This is a example of how you create the first rabbit :var rabbit1 = new Rabbit("fluffy");

After you create all your rabbits, call the describeMyself function with your rabbits.


#3

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