Basic JavaScript: Iterate with JavaScript Do…While Loops

Having trouble with Basic JavaScript: Iterate with JavaScript Do…While Loops

// Setup

var myArray = [];

var i = 10;

// Only change code below this line.

do {

myArray.push (i);

i++;

}

while (i <= 11) {

myArray.push(i);

i++;

}
var text = "";
var i = 0;
do {
  text += "The number is " + i;
  i++;
}
while (i < 5);

Do while loop should need to write as i have shown you

I did what you suggested and my test says that:
myArray should equal [10] .

i should equal 11

this is not the solution for your problem this is just a pattern how you need to use do while loop man
if you need help post link of your problem

So this is the syntax for the do…while loop

do {
  (your code that loops);
} 
while (condition);

This is like a while loop except the looping code is always done AT LEAST once. So it does the code, and then checks the condition, and then if the condition is met, it loops. If the condition isn’t met, then the loop ends.

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make easier to read.

See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.

Note: Backticks are not single quotes.

markdown_Forums