+ 1
Why does it go on indefinitely?
Building a random generator that would generate four numbers on clicking the button but it doesn't stop at four using Jscript. Don't run it! You may have to force close your app. What can I do to stop it at the 4th time? https://code.sololearn.com/W7W6rDYwYdLG/?ref=app
2 Answers
+ 4
Your click event is useless because you cancel it before it has time to take effect. Your setInterval call sets an interval to repeat indefinitely until you cancel it.
+ 4
This disables button clicking, while waiting for the four alerts.
https://code.sololearn.com/WVnack4Y7D1u