label-1

 

JavaScript labels are used to identify loop and then using break or continue statements to indicate whether a program should interrupt the loop or continue its execution. See the code snippet:

 
 
 
<!DOCTYPE html> <html> <head> <title>Welcome to LearnKode - A code learning platform</title> </head> <body> <script> var a, b; outer: for (a = 0; a < 2; a++) { inner: for (b = 0;b < 2; b++) { if (a === 1 && b === 1) { continue outer; } document.write("a = " + a + ", b = " + b + "<br>"); } } </script> </body> </html>
Output