const dreamDestinations = ['Tokyo', 'Sydney', 'Rome'];
for(let i = dreamDestinations.length - 1; i >= 0; i--) {
console.log('Exploring ' + dreamDestinations[i] + ' would be amazing!');
}
Hey everyone, I have a question about the logic behind using "-1" in the for loop to reverse the order. I understand that
for(let i = dreamDestinations.length; i >= 0; i--) {
allows the loop to run backwards, but why is "-1" necessary when printing the array items in reverse?