I am trying to count from 5 to 0… why this one wouldn’t work?
// Setup
const myArray = [];
let i = 6;
while (i < 6 && i > -1){
myArray.push(i);
i--;
}
// Only change code below this line
I am trying to count from 5 to 0… why this one wouldn’t work?
// Setup
const myArray = [];
let i = 6;
while (i < 6 && i > -1){
myArray.push(i);
i--;
}
// Only change code below this line
What is the value of i
when you reach the while
statement for the first time?
I see…
it worked this way…
// Setup
const myArray = [];
let i = 5;
while (i <= 5 && i > -1){
myArray.push(i);
i--;
}
// Only change code below this line
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.