Iterate with JavaScript While Loops 12

Please guys how do I turn these code output to [ 5, 4, 3, 2, 1, 0]

  **Your code so far**

// Setup
const myArray = [];

// Only change code below this line
let i = 0;

while (i < 6) {
myArray.push(i);
i++;
}

console.log(myArray);
  **Your browser information:**

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

Challenge: Iterate with JavaScript While Loops

Link to the challenge:

You need i to be getting smaller. How can you make that happen?

@JeremyLT I need the code to do the opposite of the current output, hence Iā€™m asking for help?

and one of the steps is to have the i getting smaller instead of bigger

so how do you make your i smaller?

1 Like