Labels are not commonly used, and many developers do not understand how they work. Moreover, their usage makes the control flow harder to follow, which reduces the code's readability.
var matrix = [
[1, 2, 3],
[4, 5, 6],
[7, 8, 9]
];
outer: for (var row = 0; row < matrix.length; row++) { // Noncompliant
for (var col = 0; col < matrix[row].length; col++) {
if (col == row) {
continue outer;
}
console.log(matrix[row][col]); // Prints the elements under the diagonal, i.e. 4, 7 and 8
}
}
for (var row = 1; row < matrix.length; row++) { // Compliant
for (var col = 0; col < row; col++) {
console.log(matrix[row][col]); // Also prints 4, 7 and 8
}
}