JSFiddle - React, Tailwind, and code Playground
HTML
<body>
<div>
<p id="reloj">00:00:10</p>
<button onclick="activar()">Activar</button>
<button onclick="parar()">Parar</button>
</div>
</body>
CSS
#reloj {
padding:40px 0;
line-height:1;
background: skyblue;
text-align:center;
font-size:120px;
color: greenyellow;
text-shadow:0 5px 10px red;
border: solid;
border-color: red;
}
JavaScript
var t=10;
var tiempo;
function cuentaatras() {
if (t==0) {
document.getElementById('reloj').innerHTML="TIEMPO ACABADO";
clearInterval(tiempo);
} else {
t--;
document.getElementById('reloj').innerHTML="00:00:0"+t;
}
}
function activar () {
tiempo = setInterval(cuentaatras,1000);
}
function parar() {
clearInterval(tiempo);
}