Loop iteration confusion

Hello. I wanted to know what I was missing here. Or did wrong. Thanks.

It is easier to help with your actual code instead of pictures. Thanks.

At a glance, I don’t think that you are supposed to log the index number. Also, your logged values aren’t in all caps.

const people = ["Scooby", "Velma", "Daphne", "Shaggy", "Fred"]; //DONT TOUCH THIS LINE!


for (let people = 0; i < people; people.length; i++) {
    console.log(i, people[i]);

I'm not sure what is happening here but I think I'm missing something in the for loop. 


Just like in your other thread, you are using console.log() strangely.

Why did you add i here?


  1. I don’t know how to code or
  2. I’m lazy lol.

Kidding of course. But I actually thought there would be a need the people part that it needed to attach it to loop. I don’t know. I guess I don’t need it and it could just be

console.log (people[i]) then?

I’d give it a try. There isn’t anything to “attach it to the loop” except for the fact that your are inside of the loop body (given by the two {}s).

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