25. Printing using a for loop?


Being a lazy guy, I had to attempt using a for loop to complete the exercise. I didn't get an error, but it also didn't print anything...

Here is the for loop in question.
for (var x=1; x===3; x++){

My question is this: how would I go about printing the describeMyself function for rabbit1, rabbit2 and rabbit3, without having the call them individually?


Use console.log? :slightly_smiling:


I should have probably specified that the describeMyself function had a console.log() in the code itself. So I was trying to figure out a way to call each variable (rabbit1, rabbit2, and rabbit3).describeMyself


What I would do is use a different kind of for loop. Put the different rabbits into an array, and then iterate through it like so:
for(var rabbit in rabbits) {
rabbit.(method name)