Iterate odd numbers help

Can someone explain why I console log this, the return is 1 2 3 4 5 and not odd numbers like the challenge asks? The tests passed too.

  **Your code so far**

// Setup
var myArray = [];

// Only change code below this line
for (let i = 1; i < 10; i+=2){
if (i % 2 !== 0){
  **Your browser information:**

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

Challenge: Iterate Odd Numbers With a For Loop

Link to the challenge:

The myArray.push(i) pushes item to the array, but it returns new length of the myArray and that number is printed to the console.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.