Creating a variable that acts as a flag to jump to the outer loop is one way, but JavaScript provides shortcuts that I think make code easier to read and also reduce the amount of code:
outerloop: while(valid){ for(loop through associative array){ if(!valid){ break outerloop; } } }
Here is some information about labels here. Scroll down to the labels section. You could even keep going out.
source share