setInterval
: https://jsfiddle.net/j29pf67j/1/var counter = document.getElementById("counter")
var hiddenText = document.getElementById("hidden-text")
var run = function(seconds) {
var interval = setInterval(function(){
if (seconds > 0) {
counter.textContent = seconds--;
}
else
{
hiddenText.style.display = "block";
counter.style.display = "none";
clearInterval(interval);
}
}, 1000)
}