Loop in JavaScript until a condition is met

Funktion

I'm trying to loop indefinitely until a condition is met...is the following correct?

It seems not to be.

    var set = false;
    while(set !== true) {
        var check = searchArray(checkResult, number);
        if(check === false) {
            grid.push(number);
            set = true;
        } 
    }
Nina Scholz

Basically, you can make an infinite loop with this pattern and add a break condition anywhere in the loop with the statement break:

while (true) {
    // ...
    if (breakCondition) {            
        break;
    } 
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Continuos loop until condition is not met

Execute the loop until the condition met

R loop until condition is met

Javascript looping until condition met

Trying to loop an API call until condition is met

Loop until condition is met or time has elapsed

Repeat loop step until a condition is met

Is there a way to nest a loop in JavaScript until a condition is met? Like a while loop but nested?

Hiding a button until a condition is met (Javascript)

Disabling button until condition is met (javascript)

Store variable with multiple condition in for loop until condition is met in R

Do Until Loop Condition Met - but Loop continues - Powershell

NodeJS - While loop until certain condition is met or certain time is passed

How do I stay in a for loop's element until a condition is met?

How to constantly re-loop through code until a condition is met?

Loop over and count columns in a data frame until condition is met

delay execution of a jQuery/javascript function until certain condition is met

Execute ansible include_tasks until a certain condition is met (kind of while until loop)

How to make my loop check the if statement until the condition is met / basically until the button appears on screen?

Awaitatility, polling until condition is met

Do action until condition is met

Collapse Cells until a condition is met

R sample until a condition is met

Repeat prompt until condition is met

Finding row until condition is met

While loop if condition is not met

Loop only if condition is met?

How do I end a JavaScript while loop when a condition is met

Counting rows until a condition is met in R - NAs before the condition is met