Tell us what’s happening:
I am using “while” to make a loop, but the result is [0,1,2,3,4,5], where as the question requires [5,4,3,2,1,0]
So how can I change the order of numbers? Your code so far*
// Setup
var myArray = [];
var i = 0;
// Only change code below this line
while(i<= 5) {
myArray.push(i);
i++;
}
console.log();
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36.
There is no such thing as count up or count down in programming I’m afraid. It’s just procedure steps that you can control:
STEP 1. CREATE NUMBER
STEP 2. CHECK IF NUMBER SATISFIES CONDITION
STEP 3. PUSH NUMBER TO ARRAY
STEP 4. CHANGE NUMBER
STEP 5. GO TO STEP 2
Now in order to get countdown from 5 to 0, think what would be the number in step 1, condition in step 2 and how are you going to change number in step 4.