Constructors in Review - describeMyself not showing in console log


I think I get the exercise here but I don't understand why my new objects created (rabbit1, rabbit2, etc) are not displaying the "describeMyself" functions of each new object in the console.

Can someone explain why it's not showing?

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


Recall that a method needs to be invoked.



Thank you. That worked!

For lack of better words, so I need to have an argument "( )" for all methods, even when there are none. Is that right?


Yes, that is right. Consider,



function() {
    console.log("I am a " + this.adjective + " rabbit");

When we leave off the parens (argument) we are referring to the string representation of the method, not the return value.


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