There is no strict pause or restart for JavaScript timers, only clear and stop, but it can be achieved through some "dissues".
allChild[index].onclick = function(){//Shut the timer time when clicking on the target and the following conditions are met if(gamInt == true){$("#tu").css("display","block");//The timer pause (clear the timer) clearInterval(countdownTimer);//The game continues after 2 seconds delay timer pause ends setTimeout(function(){// Remove all pictures removeImgFun();$("#tu").css("display","none");imgNum++;if(imgNum >= 10){imgNum = 10;}createImgFun();//The timer continues to be connected. The time before the time is increased. Continue to play (recise the previous timer once, including the timer name (it must be otherwise it will easily cause the computer to crash) is fully introduced) countdownTimer = setInterval(function (){countdownNum -= 0.01;//Retain two decimal places countdownNum = countdownNum.toFixed(2); if (countdownNum <= 0){clearInterval(countdownTimer);//The game end alert("Game end!");//Jeff Chan-ming can no longer click (the score is not counted anymore)gamInt = false;}time.innerHTML = "Countdown:" + countdownNum + "seconds";},10);},2000)//Scores += 1;score.innerHTML = "Th" + scores + "off";if(scores > 8){$("#wc").css("display","block");$("#haha").css("display","none");$("#cj").on("click",award());$("#sm").on("click",explain());}}}The above is the method of pausing and continuing the JavaScript timer introduced to you by the editor. I hope it will be helpful to you. If you have any questions, please leave me a message and the editor will reply to you in time. Thank you very much for your support to Wulin.com website!