Iterate Odd Numbers With a For Loop. why? Don't work my code?

Iterate Odd Numbers With a For Loop. why? Don't work my code?
0

#1

Tell us what’s happening:

Your code so far


// Example
var ourArray = [];

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

// Setup
var myArray = [];

// Only change code below this line.
for (var i = 1; i <= 9; i += 1) {
  myArray.push(i);
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.125 Amigo/61.0.3163.125 MRCHROME SOC Safari/537.36.

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


#2

If you increment by 1 each time, you’ll push all integers in the range to the array, not just the odd ones.


#3

Thank you. I solved the problem