An indexed loop uses a counter to visit array positions.
const colors = ["red", "blue"];
for (let index = 0; index < colors.length; index += 1) {
console.log(colors[index]);
}
// Output:
// red
// blueindex = 0 starts at the first position.index < colors.length allows indexes 0 and 1. The last index is one less than the length.colors[index] reads the item at the current position.Display the supplied packing list as 1. charger, 2. notebook, and 3. bottle. Use the loop index both to read each item and create its visible number.
The array index and the number shown to a person start at different values.