Consturctors in Review


Hey... so I have my code and it lets me pass to the next exercise but the thing is that in the console it loggs [Function] three times in a row. I think a sentance should be show there instead of those [Function]s. Btw heres my code and let me know how to fix this. Thanks. ^.^

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


Well rabbit3.describeMyself is a [Function] or rather a method but anyway what you would be more interesting than printing the function itself might be to call the function and print what gets returned:



So its not supose to print things like... "I am a fluffy rabbit"?


It is, but therefore you need to call the function and print the result not to print the function:

console.log(rabbit3.describeMyself) //prints function
console.log(rabbit3.describeMyself()) //prints result of function call


Okay understood. Thank you for your time. ^.^