+ 9
How create infinite loop in javascript?
with out crash in browser
9 Respuestas
+ 9
it cause stop working in my browser
+ 3
Time limit exceeded only means that the loop takes too much time, not that it is infinite. Here is the proof of what I said :
https://code.sololearn.com/c8wNnNcSS7iw/?ref=app
PS : you forgot a semicolon
+ 2
for (;;)
or
while (true)
+ 2
@Aleksey, your solution is not infinite (@$Vengat, I think yours too, but I am not sure with JS)
x will reach INT_MAX, and INT_MAX + 1 == INT_MIN (due to binary representation of int)
As INT_MIN < 0, your loop will break
+ 2
setInterval()
+ 1
while(x>0){
//There what you want
x=x+1;
}
Thats on c++, I think you can do it on js
+ 1
for (var i=0;i>-1;i++)
Basically a consistently true case
+ 1
Use setinterval() if performance is not a requirement.
https://www.w3schools.com/jsref/met_win_setinterval.asp
0
@Baptiste, sry but it's infinite
https://code.sololearn.com/c7UYvxqKuNO8/?ref=app