January 2001
Beginner
312 pages
6h 4m
English
The continue statement is used in conjunction with the while, do...while, for, and for...in statements. The continue statement enables you to force the computer to perform another iteration.
Therefore, if the continue statement is placed directly in the body of a statement, all statements that follow are ignored. Here's an example:
<script language="JavaScript">
<!-- Cloaking device on!
var x = 0;
while (x < 10)
{
x++;
alert(x);
continue;
alert("You never see this!");
}
// Cloaking device off -->
</script>
This effect is generally undesirable, and it is far better to use the continue statement inside if statements. In this example, the alert box is bypassed when x = 5:
<script language="JavaScript"> <!-- Cloaking device ...
Read now
Unlock full access