Answers for "add countdown timer to javascript quiz"

1

add countdown timer to javascript quiz

var count = 15;
var interval = setInterval(function(){
  document.getElementById('count').innerHTML=count;
  count--;
  if (count === 0){
    clearInterval(interval);
    document.getElementById('count').innerHTML='Done';
    // or...
    alert("You're out of time!");
  }
}, 1000);
Posted by: Guest on April-19-2020

Code answers related to "Javascript"

Browse Popular Code Answers by Language