Iterate with JavaScript For Loops help

Tell us what’s happening:
whats wrong

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 = 1; i < 6; i++){
  ourArray.push(i);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.181 Safari/537.36.

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

You’re referencing ‘ourArray’ as per the example.

Change this to ‘myArray’ and you’re golden :+1:

1 Like

oh thanks alot ! for your Help

// Example

var ourArray = [];

for (var i = 0; i < 5; i++) {

ourArray.push(i);

}

// Setup

var myArray = [1,2,3,4,5];

// Only change code below this line.

for (var i = 1; i < 6; i++){

ourArray.push(i);

}

The fix is the first answer in the thread.