why function checkend doesnt work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why function checkend doesnt work

https://code.sololearn.com/WK7xZ3cy9bBv/?ref=app pls help me 🙏🏻

27th Jul 2022, 4:06 AM
Luise Chen
Luise Chen - avatar
6 Answers
+ 3
The function checkend does work but it invokes itself once. You may want to put that logic in the loop.
27th Jul 2022, 4:36 AM
ODLNT
ODLNT - avatar
+ 3
In SoloLearn mobile app, you have to wrap your code in window.onload event handler. Full explanation avaialable here https://www.sololearn.com/post/90825/?ref=app
27th Jul 2022, 4:36 AM
Ipang
+ 3
Luise Chen Okay, you want checkend to be invoked once. With you code as is, checkend is invoked right after loop is initially invoked. https://code.sololearn.com/W4cJvqJ4Pb8w When do you want/ expect checkend to be invoked?
28th Jul 2022, 12:13 PM
ODLNT
ODLNT - avatar
+ 1
ODLNT I want to check if player complete the game(all balls dispear) and send a message. Tks for looking👏🏻, so i see checkend is working but no as i thought 🤡it looks like my condition part go wrong.
29th Jul 2022, 2:34 AM
Luise Chen
Luise Chen - avatar
0
@Ipang have added onload event and checkend doesn't work still, I'll try later. Thanks for answer me
28th Jul 2022, 9:39 AM
Luise Chen
Luise Chen - avatar
0
@ODLNT I want it to be called just for once 🤧
28th Jul 2022, 9:42 AM
Luise Chen
Luise Chen - avatar