Table of Contents
Back Button
Back to Chapter
Control Statements
No items found.
Function & Events
No items found.
Array and its Types
No items found.
OOP : Object Oriented Programming
No items found.
Javascript Standards
No items found.
No items found.
Javascript : Advanced 1
No items found.
Javascript : Advanced 2
No items found.
Additional JavaScript
No items found.

Do While Statement

You will use do...while Loop, when you want to first perform a statement and then check the condition whether to perform statement again or not.


do { // statement } while(condition)


  1. The  statements  gets executed first. Then the condition is evaluated.
  2. If the condition evaluates to true, the statements inside the do statement are executed again.
  3. if the condition evaluates to false, the statements didn't get executed.
  4. This process continues until the condition evaluates to false. Then the do..while loop stops.

Flow Chart :

Difference Between do...while and while loop.

The Key Difference between them is :


Example :

First Program is to Print  Hello World  10 Times.

let count = 50; do { console.log("Hello world"); count++; } while (count <= 10); //output //Hello world.


You must be confused, why the  Hello World  is printed, without matching the condition.

This is the game of do...while , here statements gets executed first then it check for the conditions.

After Printing  Hello World  first time, its checks for the conditions and results false. So, Loop gets terminated.

Ask queries
Contact Us on Whatsapp
Hi, How Can We Help You?