Javascript - Looping Through Arrays (for, for...of)
Code Life
By Pierre Marsaa
Visiting Every Element
Printing team[0], team[1], team[2] by hand doesn't scale. A for loop with length visits every index automatically:
↗️
Loading editor...
↶
↷
The counter i goes 0, 1, 2 and team[i] reads the element at each position. Add a fourth Codémon to the array and run again: the loop adapts on its own.
Verify