Use return falseinside the loop .each()to break free. Returning everything that is not false seems to be continue: it stops the current iteration and proceeds directly to the next.
var myArr = [1,2,3,4,5,6,7];
$.each( myArr, function(){
if( this === 3 ) return true;
if( this === 5 ) return false;
doStuff( this );
});
source
share