Execute a code block once, an then continue if condition (i < 5) is true:
let i = 0;
text += i + "<br>";
while (i < 5);
Definition and Usage
do...while statements combo defines a code block to be executed once,
and repeated as long as a condition is
do...while is used when you want to run a code block at least one time.
If you use a variable in the condition, you must initialize it before the loop, and increment it within the loop. Otherwise the loop will never end. This will crash your browser.
If the condition is always true, the loop will never end. This will also crash your browser.
code block to be executed
The condition for running the code block.
|break||Breaks out of a loop|
|continue||Skips a value in a loop|
|while||Loops a code block while a condition is true|
|do...while||Loops a code block once, and then while a condition is true|
|for||Loops a code block while a condition is true|
|for...of||Loops the values of any iterable|
|for...in||Loops the properties of an object|
do..while is an ECMAScript1 (ES1) feature.