JSFiddle - React, Tailwind, and code Playground

HTML

<button onClick = "startTimer(0,2)">Start</button>

    <p id = "timer">00:00</p>

JavaScript

function startTimer(m,s)
      {
      for	(var i = 0; i < 2; i++){
        document.getElementById('timer').innerHTML= m+":"+s;
          s == 0 ? (m == 0 ? ('done') : (m--, s=60, t())) : (s--, t());
          function t(){ setTimeout(function(){startTimer(m,s)},1000)};
      }
}