As I iterate over an array, my goal is to execute the following:
for (var i = 0; i < array.length && !(array[i][1] == 0 && array[i][2] == 'foo'); i++) {
This means that if 'i' is less than the length of the array AND it's false that array[i][1] is 0 AND array[i][2] is 'foo', then carry out a series of actions.
The issue arises when this condition doesn't work as expected. It consistently returns false whenever array[i][2] is 'foo', regardless of whether or not array[i][1] equals 0.
Interestingly, altering the for statement to this format:
for (var i = 0; i < array.length; i++) {
... and adding this snippet at the beginning of the loop:
if (array[i][1] == 0 && array[i][2] == 'foo') continue;
... resolves the issue. It seems like there might be an error in the syntax when trying to express "IF TRUE AND !(CONDITION 1 && CONDITION 2)", but I'm unsure where I've gone wrong. Can you identify my mistake?