Changes

JavaScript Flow Control and Looping

370 bytes added, 13:54, 24 April 2007
JavaScript ''do ... while'' loops
do
{
''JavaScript statement''
} while (''conditional expression'')
</pre>
 
In the ''do ... while'' example below a prompt dialog will be displayed and the user response assigned to a variable. Until that variable matches the name "John" the loop will continue to display the prompt dialog to the user:
 
<pre>
 
do
{
var userResponse;
userResponse = prompt ("Enter your name", "");
} while (userResponse != "John")
 
</pre>