January 2001
Beginner
312 pages
6h 4m
English
An iteration is the repetition of a sequence of statements either
A specified number of times
Until a condition is met
Four iteration statements are available:
The do ... while statement
The while statement
The for statement
The for ... in statement
Each of these statements performs a slightly different task, but each is a useful statement to learn how to use.
The do ... while statement runs a statement or a block of statements and then repeats the whole process until the condition expression is false. An example will clarify this:
<script language="JavaScript">
<!-- Cloaking device on!
var x = 1
do
{
++x;
alert(x);
}
while (x < 10);
// Cloaking device off -->
</script>
The previous code has a variable, ...
Read now
Unlock full access