In my javascript I have this
loopDeLoop:
while (foo !== bar) {
switch (fubar) {
case reallyFubar:
if (anotherFoo == anotherBar) {
break loopDeLoop;
}
break;
default:
break;
}
}
But JSLint says... lint warning: use of label
Here's the notes from JSLint
Labels
JavaScript allows any statement to have a label, and labels have a separate name space. JSLint is more strict.JSLint expects labels only on statements that interact with break: switch, while, do, and for. JSLint expects that labels will be distinct from vars and parameters.
How do I construct the above to get rid of the warning?
Thanks,
Greg
You are using the label correctly.
JSLint is throwing a warning because labels in Javascript are horribly bad style, and JSLint wants you to know that.
To reiterate, if you use labels at all, even correctly, JSLint will give that warning.
Edit:
Looks like you might be able to disable the label warning with a -use_of_label
configuration directive.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With