var base_url = '';

The While Loop In JavaScript

JavaScript includes while loop to execute code repeatedly till it satisfies a specified condition. Unlike for loop, while loop only requires condition expression.


while(condition expression)
    /* code to be executed 
    till the specified condition is true */


In the following example, the code in the loop will run, over and over again, as long as a variable (i) is less than 10:

while (i < 10) {
    text += "The number is " + i;


The Do/While Loop In JavaScript

JavaScript includes another flavour of while loop, that is do-while loop. The do-while loop is similar to while loop the only difference is it evaluates condition expression after the execution of code block. So do-while loop will execute the code block at least once.



    //code to be executed

}while(condition expression)


The example below uses a do/while loop. The loop will always be executed at least once, even if the condition is false because the code block is executed before the condition is tested:

do {
    text += "The number is " + i;
while (i < 10);


Contact Details

Mobile Number :
9891 222 738,
9891 50 1300

E-mail :

ADDRESS: H-17 / 263, First Floor,Sector 7,
Near Rohini West Metro Station,
Opposite Metro Pillar No. 425
Rohini, Delhi - 110085

Working hours

Day Timing
Monday To Friday 8:00 Am To 7:00Pm
Saturday 10:00 Am To 6:00Pm