Oops, try again. Make sure you created rabbit1, rabbit2 and rabbit3


#1


Constructors in Review.


Keep getting error message saying "Oops, try again. Make sure you created rabbit1, rabbit2 and rabbit3"


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");

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

console.log ("I am a" + rabbit1.adjective + "rabbit, and he is a " + rabbit2.adjective + " rabbit and the other one is" + rabbit3.adjective+ ".");

};


#2

Those names should be defined globally

If, at the very end of your code you try to print one of them, you'll find that results in a reference error (or possibly it'll say undefined)


#3

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