# Basic JavaScript - Iterate Odd Numbers With a For Loop

Tell us what’s happening:
Describe your issue in detail here.

``````// Setup
const myArray = [1, 3, 5, 7, 9];

// Only change code below this line
for (let i = 1; 0 < 10; i += 2) {
myArray.push(i);
``````

User Agent is: `Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36`

Challenge: Basic JavaScript - Iterate Odd Numbers With a For Loop

i completed the challenge but its still telle me that there is somthing wrong with the code

You should not change this line.

These lines should be read and followed

thank you so much, i have done that but its still not passing it … please is my code wrong

how do i share that please

i wil have to create another topic if i want to share it

You copy and paste your updated code into a post.

Please do not create a duplicate topic.

``````for (let i = 1; 1 < 10; i += 2) {
myArray.push(i);
}
``````

What is absolutely every line of code you have?

This part is going to be a problem for you. Is `1` ever not `< 10`?

yes it is but i have to put the condition for the loop to work

You have to put some condition into the loop. That is not the condition you want.

ok can you help me out please

I’m trying to. I can’t write the answer for you.

When do you want the loop to stop? What should happen inside of the loop?

i want the loop to stop at 9 and i am using the odd numbers

Ok, and what is changing inside of the loop? `1` never changes, it is a fixed number. Something else is changing though.

i mean from [ 1, 3, 5, 7, 9]

what it is saying is that it an indefinite loop and it won’t stop at 9

It is an “infinite” loop. This is because `1 < 10` will always be true, forever and ever.

Do you know what is changing inside of the loop? If not, you may have misunderstood how loops work.

thank you so much i didn’t pay attention to that fact. thank you once again

1 Like