Label and Continue in javascript

     Any identifier can use as label name. We can use a label to identify a loop and use the continue statements to continue the execution.

Example
 label1:
for (a = 0; a < 3; a++) {      //The first for statement is labeled "label1"
   loop2:
   for (b = 0; b < 3; b++) {   //The second for statement is labeled "label2"
      if (a === 1 && b === 1) {
         continue label1;
      }
      alert("a = " + a + ", b = " + b);
   }
}


 


Example Program:- (Editor)


Editor is Loading...

Advertisement

Nhận xét

Bài đăng phổ biến từ blog này

How to set the SDK, NDK and JDK path to android studio?

Tourist places in kk district:1) Thiruvalluvar statue

if statement