title: how do I pause and resume a timer?
body: <p>I got this function that starts a timer on this format 00:00:00 whenever I click on a button. But I don't know how to do functions resume and pause. I've found some snippets that I thought could be helpful but I couldn't make those work. I'm new to using objects in js.</p>
  
  <pre><code>function clock() {
    var pauseObj = new Object();
  
    var totalSeconds = 0;
    var delay = setInterval(setTime, 1000);
  
    function setTime() {
      var ctr;
      $(".icon-play").each(function () {
        if ($(this).parent().hasClass('hide')) ctr = ($(this).attr('id')).split('_');
      });
  
      ++totalSeconds;
      $("#hour_" + ctr[1]).text(pad(Math.floor(totalSeconds / 3600)));
      $("#min_" + ctr[1]).text(pad(Math.floor((totalSeconds / 60) % 60)));
      $("#sec_" + ctr[1]).text(pad(parseInt(totalSeconds % 60)));
    }
  }
  </code></pre>
  
  <p>pad() just adds leading zeros</p>