The code code is refusing to run don't know why help please

**its saying myArray should equal [5,4,3,2,1,0]
**

**Your code so far**

// Setup
var myArray = [];
var i = 5;
while(i < 0) {
myArray.push(i);
i++;
}
// Only change code below this line
**Your browser information:**

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

Challenge: Iterate with JavaScript While Loops

Link to the challenge:

Your code is saying while i is less than zero. Try and use console.log to see what your code is outputting.

oky let me try to do that

its still not working

what’s your code now?

// Setup

var myArray = [];

var i = 0;

while(i < 6) {

    myArray.push(i);

    i++;

}

you are starting from 0 and then increasing, the challenge asks for decreasing values instead

var myArray = ;

var i = 5;

while(i < 0) {

myArray.push(i);

i++;

You are starting i at 5 and then asking if i is less than 0. It is not, so the code inside the while code block never executes. Think about what condition you want the while loop to stop. Also, think about how you need to change the value of i to get it to meet that condition.

what should I do exactly I am confused

If you start i at 5, which is correct, at what value of i should you no longer push a value to myArray?

Okay Iet me try it again

HI @nanay !

If you are still working through the problem let me offer you some advice.

I think you should first solve this problem away from code on just pen and paper.

If someone asked you to give them a list of numbers from 5 -0 you would write this

5,4,3,2,1,0

Now that we understand the problem, you want to add each of those numbers to the array.

The while loop only executes when the condition is true.

Is 5<0.
Well no. So the loop is never run.
So you need to fix this logic where the condition is true.

once you do that then you have to fix the logic in the while loop.

This part is correct

but this part doesn’t work for the problem

If we increment by 1, then i now equals 6.

But if we look at what we are trying to do then 6 is not in here

5,4,3,2,1,0

So you need to change the logic so we can start generating the numbers in this list.

I would suggest adding this to the bottom of your code so you can see exactly what is happening
console.log(myArray)