35
rated 0 times
[
36]
[
1]
/ answers: 1 / hits: 32769
/ 14 Years ago, sat, february 5, 2011, 12:00:00
I just found out about using label s in JavaScript, such as:
for (var i in team) {
if(i === something) {
break doThis: //Goto the label
} else {
doThat();
}
}
doThis: //Label
doIt();
I've not heard about this until now and I can't find much information online about it and I'm beginning to think there is a reason for that.
It seems to me like this is similar to a GOTO
statement in other languages and would be considered bad practice. Would I be right in assuming this?
More From » loops