Bug in the problem

Tell us what’s happening:

Every time I try to complete the problem, it says “aw snap” and I have to reload the page.

Your code so far


// Setup
var myArray = [];

// Only change code below this line.
var i = 0;
while(i<=5){myArray.push(i); i++;}

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.88 Safari/537.36.

Challenge: Iterate with JavaScript While Loops

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/iterate-with-javascript-while-loops

the code execute each time you change something, at one point you are creating an infinite loop that is growing the array and the browser is overwhelmed

I suggest this:
change the condition in the while loop to false so it will never run like this:

while (false) {
  ...
}

when you have changed everything than change the loop condition to what it should be

1 Like