Constructors in Review - what is the problem?


#1

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 rebbit1 = new Rabbit("fluffy");
var rebbit2 = new Rabbit("happy");
var rebbit3 = new Rabbit("sleepy");

console.log(rabbit1);
console.log(rabbit2);
console.log(rabbit3);
(what is the problem?)
it pops
!!!! Oops, try again. Make sure you created rabbit1, rabbit2 and rabbit3


#2

here:

var rebbit1 = new Rabbit("fluffy");
var rebbit2 = new Rabbit("happy");
var rebbit3 = new Rabbit("sleepy");

you created rebbit1, rebbit2 and rebbit3. this should be rabbit1, rabbit2 and rabbit3


#3

Yep.
Here I am a fool.
Only something viewed code and noticed a problem.
In the eye is not immediately caught.
But thank that came to the rescue.


#4

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