Javascript Do While Loop

The do while loop repeatedly executes a block of statements until a particular condition is true. It first executes a block of statements and then checks the condition.

Syntax:

do {
//Block of statements
}while(condition);

JavaScript do while loop example:

<html>
<head>
<script>
var num=1;
do{
document.write(num + "<br/>") ;
num++;
} while (num<=10)
</script>
</head>
<body>
</body>
</html>
Please follow and like us:
Content Protection by DMCA.com