What is the point of using shortcuts in javascript (shortcut: here) external switches?
You can use them as goto statements on breakand continue, although admittedly you rarely see this in practice. You can find some examples here.
break
continue
Here is a quick one:
myLabel: for(var i=0; i<10; i++) { if(i==0) continue myLabel; //start over for some reason }
They are also useful in loops:
var x, y; outer: for (x = 0; x < 10; ++x) { for (y = 0; y < 10; ++y) { if (checkSomething(x, y)) { break outer; } } }
... which breaks out of both loops if it checkSomethingreturns true.
checkSomething
, , . , , goto ( JavaScript).
goto