I have a short javascript code where I need to skip to next in the for loop....see below:
var y = new Array ('1', '2', '3', '4');
for (var x in y) {
callFunctionOne(y[x]);
while (condition){
condition = callFunctionTwo(y[x]);
//now want to move to the next item so
// invoke callFunctionTwo() again...
}
}
Wanted to keep it simple so syntax may be error free.
continue
? developer.mozilla.org/en-US/docs/JavaScript/Reference/… I'm not quite sure what you want to achieve. Also, don't usefor...in
to iterate over arrays.break
the while loop and immediatelycontinue
the for loop. If there's nothing after the while, like in your sample, you could just usebreak;
continue
andbreak
with labels for amazing results!