JavaScript Continue Statement

The continue statement is used inside the loop. In continue statement if a specified condition occurs, then it skips the current iteration and execute to the next iterations of the loop. The basic syntax of Continue statement is as follows :
  continue [ label_name ]; 
Where :

  • The continue keyword skip the current iteration of the loop.
  • The label keyword is optional, it is basically transfer control to the specified label_name.

Now lets see an example of Continue statement :
<!DOCTYPE html>
  <title>Continue Statement</title>
    brk = "<br/>";
    var x = 0;
    while (x < 10) {
      if(x == 6) {
      document.write(x, brk);
Output :

As we can see in the above example when x is equal to 6, then the rest of the code will skipped and the loop will goes to next iteration.

Next Topic :