JavaScript do while loop

The JavaScript do while loop iterates the loop while loop, but, the difference is that the loop is executed at least once even when the condition is false.

With a do-while loop the block of code executed once, and then the condition is checked, if the condition is true or false. If it is true then the loop gets executed one more time otherwise gets terminated if the condition evaluates to false.

do {
// code to be executed
while (condition);

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<title> JavaScript dowhile Loop Statement </title>
var i=1;
document.write(i + "<br/>");
} while (i<=5);


JavaScript dowhile Loop Statement

Color Picker

List of color names supported by all browser »

Character Code

List of character codes to display special character »

Language Code

List of all language supported by all browser »

Country Code

List of Country code supported by all browser »