How to properly restart the function?
-
Hello, I wrote my blackjack and ran into a problem: after the hand is over and the winner is determined, the game_end () function is executed, which, in turn, calls game_start () b > to start a new game, but the new game works crookedly, and generally "stalls" on setTimeout.
How can I immediately start a new game after the end of a distribution?
Code: https://pastebin.com/xgfRVhxr
P.S Without SetTimeout, everything works as expected, only minor bugs remain, but its 3 seconds is vital for the project.JavaScript Anonymous, Jun 22, 2019 -
Didn't go into details, but:
1. game_end should clear the this.inited variable. Therefore, it does not go beyond the timeout.
2. game_end should clean up event listeners that are hung by game_startAnonymous
1 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!