Brice
1
Tell us what’s happening:
Describe your issue in detail here.
My code seems correct by I can’t pass this step.
Your code so far
// Setup
const myArray = [];
// Only change code below this line
var i = 0;
while (i < 5) {
myArray.push(i);
i++;
}
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Challenge: Basic JavaScript - Iterate with JavaScript While Loops
Link to the challenge:
Add the numbers 5 through 0 (inclusive) in descending order to myArray
using a while
loop.
If you console.log
the array after the loop has run, your code will print this to the console:
[ 0, 1, 2, 3, 4 ]
You’ll need to amend your code so that it pushes the correct values, in descending order, into your array.
system
Closed
3
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.