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 »

Latest Updates

PHP Introduction

How to Run a PHP program in Xampp?

How can I create a phpinfo.php page?

How to Define a Variable in PHP

PHP Echo and Print Statements

Working with PHP Operators

Understanding the PHP Data Types

How to Write Comments in PHP

How to Define a Constant in PHP

PHP if...else...elseif Statements