Theo's Typesafe CultTTC
Theo's Typesafe Cult13mo ago
6 replies
Harshit Raj

How to restart a game

On page load, i have a function say startGame() that runs. The page contains a toggle button, on change startGame() needs to be called again since its the main function containing the API fetch. I believe that doing so will push the newly called startGame() function over the already running one in the call stack. If so, is there any way to terminate the previous function so that it will not cause any inconsistency (JavaScript) ?
Was this page helpful?