7/8 Infinite Loop not showing correct code to start?

I don’t think this is the correct code for this section I am on. When I look in the forums for help, everyone else that has issues on this section is showing a different starting code.

Or am I doing something wrong?

Please paste in a link to the exact exercise. Thanks. (Copy the URL in the location bar.)

Question:

What happens if your Reset the lesson?

https://www.codecademy.com/courses/learn-javascript-loops/lessons/loops/exercises/infinite-loops?action=lesson_resume&course_redirect=introduction-to-javascript

I have refreshed the page and reset the lesson 4 times each. When I hit run, it counts to 36 and stops ( not infinite). I’ve tried changing the counter+= 1 to just counter++ Nothing is working for me :frowning:

edit: Also, in the picture in my first post, the instructions indicate a “for” loop which is not present.

edit2: Tried going Back and hitting Next again. The same code reappears.

edit3: Its 100% the wrong code because when I hit run, on the bottom it says “Did you change the incrementer to be ‘thingsToDoIndex–’?” thingsToDoIndex is no where to be found :unamused:

1 Like

this code:

let thingsToDo = ['do laundry', 'take out the garbage', 'make dinner', 'walk the dog', 'go to the bank'];

for (let thingsToDoIndex = thingsToDo.length - 1; thingsToDoIndex >= 0; thingsToDoIndex--) {
  console.log('I need to ' + thingsToDo[thingsToDoIndex] + '.');
}

/*
while (thingsToDo.length > 3) {
  console.log('I have too many things to do!');
 }
 */

should be at the start of the exercise. It isn’t, use the code i provided to make the exercise work. Careful, the for loop is an infinity loop

the while loop is also an infinity loop, but its a comment, so its okay for the moment

Have same problem too.

thanks for supplying the correct code

Be sure to report this issue using the Bug Reporting tool in the lesson.

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