JSFiddle - React, Tailwind, and code Playground
by eget teteete
HTML
<p>
</p>
JavaScript
var p = document.getElementsByTagName('p')[0];
var ti = 60;
console.log(p, ti);
function time() {
p.innerText = 'Осталось ' +ti + ' секунд';
ti--;
console.log(ti);
if(ti <0){
ti = 0;
clearInterval(z);
}
}
var z = setInterval(time, 1000);