Infinite loops causes my phone to lag. | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
0

Infinite loops causes my phone to lag.

Hi guys, I installed this app yesterday and have been enjoying it. As a newbie (lol), I tend to create alot of infinite loops (ignorantly of course) when learning about loops. It's sad that my phone can't handle this, since it would continue to lag even after I have cleared the app from memory. Who can relate please? What can I do?

24th Feb 2020, 8:25 PM
Unabashed_Newbie
Unabashed_Newbie - avatar
4 ответов
+ 7
I tried console.log in an infinite loop and while it does initially lag my device, force closing the app should halt the js from executing. If the issue persisted for me, I'd check my WebView implementation and attempt to either force close the standalone WebView app or Chrome. This, assuming your device is an Android ofc. It could be either one of these still executing the js in the background. https://stackoverflow.com/questions/41234678/determine-webview-implementation-system-webview-or-chrome
25th Feb 2020, 1:19 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
I've been looking at this question a bit clueless for a while now, trying to think of a possible answer. Since three hours passed without substance being added by anyone, let me tell you my opinion: Infinite loops freeze your stuff. That's what they do. That's why we try not to write them. When a human starts to babble, saying the same word over and over, you have a chance to intervene. Because humans are slow. When your computer thinks runrunrunrunrun ten million times in a second - good luck getting in between. Infinite loops will happen more rarely, as you get practice, but it'll probably never completely stop. At least I haven't experienced that so far.
25th Feb 2020, 12:02 AM
HonFu
HonFu - avatar
+ 2
i don't think web codes have a means of handling infinite loop on like the others
24th Feb 2020, 8:58 PM
✳AsterisK✳
✳AsterisK✳ - avatar
0
Thanks guys
13th Mar 2020, 8:01 PM
Unabashed_Newbie
Unabashed_Newbie - avatar