Iterate with JavaScript For Loops broken?

Tell us what’s happening:

Its not clearing the conditions to pass specifially myArray needs to be [1,2,3,4,5]
I have check the youtube video on this and they have exactly what I have.

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 (var i = 0; i < 6; i++) {
    myArray.push(i);
}  
         

Your browser information:

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

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

Your code will create an array containing 0 through 5. The instructions are to add 1 through 5.

thank you very much, user error. Should have guessed.

That’s why we have a community of support :smiley:
Happy coding!

1 Like

There are two really hard problems in code:

  • Naming things
  • Cache invalidation
  • Off-by-one errors

– Leon Bambrick

1 Like