Use logical NOT to control the loop : Boolean Operators « Operators « JavaScript Tutorial






var bFound = false;
var i = 0;

while (!bFound) {
    if (aValues[i] == vSearchValue) {
        bFound = true;
    } else {
        i++;
    }
}








2.6.Boolean Operators
2.6.1.JavaScript provides three Boolean operators
2.6.2.Logical AND
2.6.3.! (Logical NOT)
2.6.4.Use logical NOT to control the loop
2.6.5.|| (Logical OR)