The do while loop is a variant of the while loop. This loop will execute the code block once, before checking if the condition is true, then it will repeat the loop as long as the condition is true.
const cars = ["BMW", "Volvo", "Saab", "Ford"]; let i = 0; let text = ""; while (cars[i]) { text += cars[i]; i++; }
You have already seen the break statement used in an earlier chapter of this tutorial. It was used to "jump out" of a switch() statement.
const cars = ["BMW", "Volvo", "Saab", "Ford"]; list: { text += cars[0] + "<br>"; text += cars[1] + "<br>"; break list; text += cars[2] + "<br>"; text += cars[3] + "<br>"; }