
org.sonar.l10n.javascript.rules.javascript.LabelPlacement.html Maven / Gradle / Ivy
Any JavaScript statement can be identified by a label, but those labels should be used only on 'while', 'do-while' and 'for' statements.
The following code snippet illustrates this rule :
label: // Non-Compliant
if (i % 2 == 0) {
if (i == 12) {
print("12");
break label;
}
print("Odd number, but not 12");
}
loop: // Compliant
for (i = 0; i < 10; i++) {
print("Loop");
break loop;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy