If you want to add more time in a loop based on time period, you may end up running infinite loop.
It's possible that you really need to change the break loop condition inside loop though. In this case, you are using a wrong kind of loop. You would need to use the
while
loop. Alternatively, you use "infinite while" loop by using True condition under
while
, and, in this case, use
break
state in the
if
statement inside loop to break from the loop explicitly, for example:
while (true) {
breakCondition =
if (breakCondition) {
break;
}
}
Please see, for example:
http://www.echoecho.com/javascript9.htm[
^].
—SA