For loop backwards


The instructions state the following…
We need to make three changes to our for loop:
Edit the start condition (var i = 0), to set i equal to the length of the vacationSpots array.
Then, set the stop condition ( i < vacationSpots.length) to stop when i is greater than or equal to 0.
Finally, change i++ to i-- to subtract 1 from i each loop.

QUESTION–If the stop condition is EQUAL OR GREATER THAN 0, then when the the for loop begins, the variable is already GREATER than 0 so why does it continue? CAN SOMEONE EXPLAIN THIS?

var vacationSpots = ['Paris', 'New York', 'Barcelona'];

for (var i = vacationSpots.length - 1; i >= 0; i--) {
	console.log('I would love to visit ' + vacationSpots[i]);


The misnomer is that this is the stop condition, when that is not the case. It is the while true keep running condition. As long as i is greater than or equal to 0 the loop will continue to iterate.


As a beginner, most of the challenge is grappling with terminology. There must be a reason for the less than intuitive name of “stop condition”… Anyway, you quick concise explanation is appreciated!


Thank you! This helps SO much!


Hi, this is a simple task yet uncompletable (apparently). Its asking me to create a variable titled ‘myplaces’ and set it equal to 3 arrays of places i would like to visit. can anyone review both sets of my code and explain to me where i might be going wrong?

ive tried both the default code and attempting it from scratch with my own code.

thankyou :slight_smile:


instructions set


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.