Iterate with JavaScript Do...While Loops (need help)

that’s what i had but it wouldn’t pass with 11. it passed with 5 though.

whatever works for you man

yup. its bugged. anyways man keep up the good work

thanks again. take care.

It’s not buggy, read the requirements.

Change the while loop in the code to a do…while loop so that the loop will push the number 10 to myArray, and i will be equal to 11 when your code finishes running.

Meaning it only runs one time, you can pass with this code.

do {
  myArray.push(i); // push the number 10 to myArray
  i++;             //  i will be equal to 11
} while(false)     // when your code finishes running
1 Like

It is not true that this will not run with i < 10, a do … while loop always run the first time and then check the condition

With this way of thinking you will not learn much… it is really useful to consult documentation even when helping someone else to be sure of what you are saying before teaching something terribly wrong