Code got correct but getting weird output :(


#1


https://www.codecademy.com/en/courses/spencer-sandbox/3/6?curriculum_id=506324b3a7dffd00020bf661


No error messages. I succeeded the topc. Just the output is weird and inappropriate.


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

console.log(rabbit1.describeMyself + rabbit1.describeMyself + rabbit1.describeMyself + ".");


#2

Try this ....

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

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

#3

Ohk. I got my confusion cleared. Thanks! :smile:


#4

welcome :slight_smile:


#5

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