I have a good solution of this problem

Tell us what’s happening:
Describe your issue in detail here.
we can easily solve this particular problem by using reverse() function in java script .

example= const myArray = [];
let i = 0;
while(i<6){
myArray.push(i)
i++
}
var result = myArray.reverse()
console.log(result)


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

  **Your browser information:**

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.110 Safari/537.36

Challenge: Iterate with JavaScript While Loops

Link to the challenge:

That works, but it misses the point of the challenge. I’d make sure you know how to do this purely with a loop.

2 Likes

Don’t call it “easily” if your suggested solution is MORE COMPLICATED than the actual solution O.o

we can start loop with end point 6
example i=6

That’s what they are looking for.

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