here is an example https://codepen.io/agafron/pen/pdQNJJ?editors=1010

How can I prevent the StartTir () and startDemo () functions from repeated clicks on the NewGame button or start, or in turn on NewGame / start?

when you click on NewGame / start one by one, the images overlap each other.

How to set the conditions correctly?

I apologize if I didn’t ask the question very correctly, I just don’t know how to state it more specifically.

whenever possible, changes are needed in this part:

newGame.onclick = function () { //loadWord(); if(!button.classList.contains('demo')) { button.classList.toggle('demo'); endGame(); startDemo(); } } button.onclick = function () { if(!button.classList.contains('play')){ button.classList.toggle('play'); endDemo(); //getWords(); startTir(); } }; 

Thank!

  • Your code already does this. - Igor
  • @Igor, does not - Grundy
  • @Grundy means I did not understand him - Igor
  • @Igor, so how can I do this? or need to change the game code? - agafron

0