Home >> Javascript >> Do while loop in Javascript

Do while loop in Javascript

The main difference from regular while loops is that the first iteration of a do-while loop is guranted to run ,where as it may not neccessary run with a regular while loop.

Syntax

do{
    // Code to be executed
}
while(condition);

Example

var i=0;
do{
    document.write(i+"<br>");
}
while(i>0);

Post Your Comment

Next Questions
Functions
Objects
Array
Events
Onchange event
Onclick event
Onmouseover event
Onmouseout
Onkeydown event
Onload event

Copyright ©2022 coderraj.com. All Rights Reserved.