Changes

Jump to: navigation, search

JavaScript Flow Control and Looping

1 byte added, 17:56, 26 May 2007
JavaScript ''while'' loops
The ''for'' loop described above works well when you know how many times a particular task needs to be repeated. Clearly there will often be instances where something needs to be repeated until a certain condition is met, with no way of knowing how many repetitions are going to be needed to meet that criteria. To address this need JavaScript provides the ''while'' loop. In essense the ''while'' loop repeats a set of tasks until a specified condition is met. The ''while'' loop syntax is as follows:
<pre>
while (''condition'')
{

Navigation menu