I do not understand how to make the code to prompt:5 4 3 2 1 0

I do not understand how to make my code to prompt 5 4 3 2 1 0
what is wrong??? :thinking: I tried my best to solve it I listened to the video I red the hints and I still do not understand how to make my code prompt 5 4 3 2 1 0.

  **Your code so far**

var myArray = [];

var i = 0;
while(i < 5) {
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/97.0.4692.99 Safari/537.36

Challenge: Iterate with JavaScript While Loops

Link to the challenge:

The challenge asks you to count backwards from 5 to 0(inclusive) . You are doing it the other way (from 0 to 5)
You just need to modify the code a bit to solve this.

Tip: Set the end value to -1 or use the greater than or equal to operator

Good luck !

Ok @Exotic ! I will try it.

oh man! It did not work and shows (I mean blank) :face_with_diagonal_mouth: can you do something
???

hey. I worked! topic finished.

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