white screen on the right and no looped write cycles | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula gr√°tis
0

white screen on the right and no looped write cycles

hi everyone! please tell me why when I'm making "While" cycle as neverending (condition 3 was removed) nothing happens? we have return command "Write", so system should write X values without stopping, but system just hanging my browser every time )) I just want to see lots of continuosly written X values, but I see just white screen at the right side, and that is not correct the logic is: x=0 while x < 1 write x, so why X was not written on the screen? this should be done by the system before returning to the while section.. right?

7th Feb 2017, 1:15 PM
Andrey Yakovlev
Andrey Yakovlev - avatar
4 Respostas
+ 11
Put some delay......
7th Feb 2017, 1:19 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 11
setInterval(callback,milliseconds);
7th Feb 2017, 1:20 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 10
while can only hold one parameter like while (x < 5)
7th Feb 2017, 1:24 PM
David Sebastian Keshvi Illiakis
David Sebastian Keshvi Illiakis - avatar
+ 2
Infinite or never ending loops will definitely crash your browser. Even humans tend to go crazy when they sit in one spot and try to crack a problem till eternity (I hope you get the analogy). Because your loop runs forever, the browser keeps trying to evaluate your code, 'forgetting' to perform other tasks it needs to. This is why it appears to be freezing. If you need your code to run infinitely, use a timer with a small amount of delay. Of course you'd run into timing issues, but that is if you would mind.
8th Feb 2017, 2:57 PM
John
John - avatar