I don't understand the console output!


Here's the output console:

"I am a fluffy rabbit
I am a happy rabbit
I am a sleepy rabbit
undefined "

It worked but I don't understand why there're 3 lines with ''unidentified"?


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

var list=[rabbit1,rabbit2,rabbit3];
for (var i=0;i<3;i++){


This happens when we console.log() the return value of a function lhat already logged out the value, and returned nothing. Hence, the return value is, undefined.


oh i got it. Thank you so much :slight_smile:


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