3 ms·
Well sure, but you're just doing it wrong. Here's the goto equivalent. var itemsPassed = 0; var i, j; top: do { for (i = 0; i < item
by kristopolous 9y ago
Well sure, but you're just doing it wrong. Here's the goto equivalent.
var itemsPassed = 0;
var i, j;
top:
do {
for (i = 0; i < items.length; i++) {
for (j = 0; j < tests.length; j++) {
if (!tests[j].pass(items[i])) {
continue top;
}
}
itemsPassed++;
}
break;
} while(1);
Not a great pattern but there you go.
- microcolonel 9y agoYou can just pass 0 to while, and ditch the break. ;- )
- kristopolous 9y agoNo you can't. Try it if you don't believe me
- microcolonel 9y agoOh, forgot the weird label behaviour in JS, you're right. Funny to have the label up top, but the branching condition somehow in its way.