Iterate with JavaScript For Loops - not able to pass challenge?

Iterate with JavaScript For Loops - not able to pass challenge?
0

#1

Tell us what’s happening:

Your code so far


// Example
var ourArray = [];

for (var i = 0; i < 5; i++) {
  ourArray.push(i);
}

// Setup
var myArray = [];


// Only change code below this line.

for /** each time */ (var myVar = 0; myVar <= 5; i++) {
  myArray.push(myVar);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

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

Hi guys, each time I run this code my browser completely freezes (only on this challenge).
Any idea what’s up guys? Do you experience the same?

Alex / Ale8k


#2

The error is on this line, I’ll let you try to figure it out


#3

Sorry didn’t mean to leave the i++; but still the same, page freezes? :s It passes the question but the page becomes frozen - all freecodecamp pages in fact.


#4

Possibly could be as simple as clearing the cache on your browser - I’m wondering if having the i there originally might have caused the page to go into an infinite loop (i would have gone to 5 originally, then in your loop it would have increased from 5, so your loop would never have stopped, and eventually the browser would have run out of memory)