Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • while and do while loops in Javascript

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 119
    Comment on it

    Hello Readers if you are confusing in while and do while loop in Javascript then this blog will be helpfull to you.

    Lets see both of them working:-

    First we will how while loop works:-

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

    Now lets see how do while work:-

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

    So now you have seen the major difference between both the loops is, In case of while the comparisons is done in beginning where as in case of another it will done at the bottom. But still you can choose the loop type what you like both works in same time.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: