JavaScript Do-While Loop

JavaScript Do-While Loop


JavaScript do/while loop
The do/while loop is a variant of the loop with one but there is one of the major differences is the body of do/while loop is executed once before the condition is checked. Then it will repeat the loop as long as the condition is true.
The Syntax of do/while loop is as follows:
Initialization
do {
      // loop Statements;
      Update;
} while (condition);
 
Flowchart of do/while Loop:
JavaScript while and do...while Loop (with Examples)
Example – Write a Program to Print 1 to 10 integers:
Output