No se como ordenarlo de forma descendente

Suma los números del 5 al 0 (inclusive) en orden descendente para myArray usar un while bucle.


// Setup
var myArray = [];
var i = 0;
while(i < 6){
myArray.push(i);
i++;
}
console.log(myArray)
// Only change code below this line

  **Your browser information:**

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

Challenge: Iterate with JavaScript While Loops

Link to the challenge:

They want descending numbers in the result myArray, e.g.:

[5,4,3,2,1,0]

consider what needs to change within the while loop condition to make the while loop break at the right number, also how to change i so it decrements instead of incrementing.

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