157
rated 0 times
[
159]
[
2]
/ answers: 1 / hits: 21019
/ 13 Years ago, wed, may 4, 2011, 12:00:00
I have always believed you use continue as follows:
var i;
for (i = 0; i < 10; i++) {
if(i%2===0) {
continue;
}
}
Or
var i, myloop;
myloop: for (i = 0; i < 10; i++) {
if(i%2===0) {
continue myloop;
}
}
But when I run these two snippets of code through JSLint, I get the error:
Problem at line 5 character 5: Unexpected 'continue'.
continue;
What am I doing wrong? What is the correct usage?
More From » loops