let myPlaces = ['Place1', 'Place2', 'Place3'];
let friendPlaces = ['Place4', 'Place5', 'Place6'];
for (let myPlacesIndex = 0; myPlacesIndex < myPlaces.length; myPlacesIndex++) {
console.log(myPlaces[myPlacesIndex]);
for (let friendPlacesIndex = 0; friendPlacesIndex < friendPlaces.length; friendPlacesIndex++) {
console.log(friendPlaces[friendPlacesIndex]);
}
}
I don't understand the logic behind the inner "for loop" looping completely all at once. I expected the order that should have been printed to the console to be: Place1, Place4, Place2, Place5, Place3, Place6.
Can someone explain to me why that is?