JSFiddle - React, Tailwind, and code Playground

HTML

<div id="timer"></div>
<button id="pause-timer">pause timer</button>
<button id="resume-timer">resume timer</button>

JavaScript

$(document).ready(function(){
    var intervalID;
    var gameTimer;
    // 1000 mS equivalent to 1 second
    var timeInterval = 1000;
    
    gameTimer = function(){
        var oldTime = Number($("#timer").text());
        var newTime = oldTime + 1;
       $("#timer").text(newTime);
    };
    
    intervalID = setInterval(gameTimer,timeInterval);
    
    $("#pause-timer").on("click",function(){
    	/** in case you need to remove the interval function **/
    	clearInterval(intervalID);
    });
    $("#resume-timer").on("click",function(){
    	intervalID = setInterval(gameTimer,timeInterval);
    });
	
});