JSFiddle - React, Tailwind, and code Playground

HTML

<div id="counter">0</div>
<div>
  <input type="button" id="pause" value="Stop/Start"/>
</div>

JavaScript

(function(){
	var counter=document.getElementById('counter'),
  		pause=false,
      delay=0;
      
  (function count(){
    if((delay+=100)>=1000 && !pause)
			delay=counter.innerHTML++*0;
    
    setTimeout(count,100);
  })();
  
  document.getElementById('pause').onclick=function(){
  	pause=!pause;
  };
})();