Do while loop in Javascript

Do while loop in Javascript


In this article we are goanna to see about do while loop and where we use these. which is most important when you are going to start your career in JavaScript. Please read and enjoy this article if you want to give any feedback about your experience, we welcome.



The do while loop is similar to while loop, but the condition is checked after the loop body is executed. This ensure that the loop body is run at least once.

Syntax:

do {

      statements;

      increment/decrement;

} while(condition);

 

Ex:

Var i = 0;

do {

            document.write(i + “<br>”);

              i++;

} while(i<3);


Share:

0 comments

Please leave your comments...... Thanks