5.5.5 while..do statement

The while loop is used when you want the loop to execute and continue executing while the specified condition is true.  It tests the condition at the beginning of the loop, itself if the condition is true it executes the statements within the body of the loop or else it terminates.

<script type =”text/javascript”>
Var myCounter = 0;
Var linebreak = “<br/>’;
document.write(“while loop is beginning”);
while (myCounter < 10) {
document.write (“myCounter =”+ myCounter);
Document.write (“while loop is finished!”);


Sign-up for our email newsletter and get free job alerts, current affairs and GK updates regularly.
Subscribe Here (or)

2 Responses to “5.5.5 while..do statement”

  1. Sugel says:

    Since the body of the loop does not modify number, then it will always be -1 when evaluating the condition, and thus the condition will always evaluate to true. The loop never stops executing.

Leave a Reply

Your email address will not be published. Required fields are marked *

5 × four =

Popup Dialog Box Powered By : XYZScripts.com
  • RSS
  • Facebook
  • Google+
  • Twitter