+ 2
SoloLearn stops working and so does my phone when using loops.
SoloLearn stops working when I use the for, while and do while loops. The code doesn't work unless I restart the app. Does this happen to anyone else?
8 ответов
+ 2
Is that all the code?
That code shouldn't be causing an issue as long as there isn't another variable i that could be getting changed in the loop and then attempting to use it after in the wrong context. To avoid that issue all together you should use the 'let' keyword to make the i variable local.
for(let i=1; ...etc
You may want to close the app or browser etc and restart your device or computer and try again.
+ 4
Maybe you have an infinite loop without an exit condition
+ 3
Try a for loop that iterates a finite number of times and it should work.
+ 1
Yeah mabye
I just started JavaScript, how would I know😂?
+ 1
Post your code
0
Well if i tried a piece of code ran it ,changed it ran it again ,changed it back to what it was first and ran it, itwouldn't work. After a while my key board won't respond all the buttons will either not respond or are delayed by several seconds.
0
This is an example
for (i=1; i<=5; i++) {
document.write(i + "<br />");
}
Then I would change it to
for (i=1; i<=6; i++) {
document.write(i + "<br />");
}
Then back to
for (i=1; i<=5; i++) {
document.write(i + "<br />");
}
0
Thanks you, will do