I was trying to write the following code in a way that the console would output the elements in vacationSpots
backwards (ie. "I would love to visit Tulum","I would love to visit Paris", "I would love to visit Bali"
.
const vacationSpots = ['Bali', 'Paris', 'Tulum'];
for (let i = 2; i <= vacationSpots.length; i--) {
console.log(`I would love to visit ${vacationSpots[i]}`);
};
However, whenever I run the code, the console returns the following:
Could someone please explain what this error means, and how I should fix my code? Thank you so much!