A
switch
statement is not a loop. Moreover, if what is at
something[i]
is not 1 or 2, nothing will be excuted and will silently pass.
You will have to put a breakpoint on the
for
line and debug line by line to see what is going on.
You may want to add a
default
case to account for unanticipated values:
switch (something[i]) {
default:
alert("unexpected value: " + something[i]);
break;
}