Harshit Raj
TTCTheo's Typesafe Cult
•Created by Harshit Raj on 12/30/2024 in #questions
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) ?
7 replies