25. Constructors in review



My code passes, but prints "undefined" to the console between each of the rabbit descriptions and I don't understand why. Any ideas?

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



Each time you call describeMyself you are calling console.log twice, see that? In one of the cases you aren't thinking about what value it is you're logging.


Perfect! Thank you, just didn't read the pre-written code properly.


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