title: Enable break times in javascript countdown timer
body: <p>I'm in the middle of an exercise on freecodecamp.com where we were asked to build a pomodoro timer similar to the one in <a href="http://codepen.io/GeoffStorbeck/full/RPbGxZ/" rel="nofollow">this link</a></p>
  
  <p>I approached it by trying to format two date objects and find the difference then try to format it into min:sec format i.e 2:05 format (there might be lots of better ways).
  I've been able to write up to a point where I can start the timer, pause the timer and also continue the timer from the paused point. However, if I set the end time to be <code>new Date("July 21, 1983 00:01:05")</code> I noticed that the timer jumps from 1:00 to 0:58.
  Also the exercise says there should be a break time i.e the break time should start after the session time ends and when the break time ends the session time should start again. This I've not been able to replicate. I tried to create another set of date objects with the break time i wanted to compare and then countdown but when it ends, it starts the break time over again instead of jumping to the session time. I really do not want to copy codes from finished exercises, I want to figure this out myself (with some help if necessary).</p>
  
  <pre><code>    &lt;div id="update"&gt;&lt;/div&gt;
   &lt;button class="start" onclick="count()"&gt;start&lt;/button&gt;
      &lt;button class="pause" onclick=" pause() "&gt;Pause&lt;/button&gt;
      &lt;button class="play" onclick=" play() "&gt;Continue&lt;/button&gt;
  
  &lt;script&gt;
      var start = new Date("July 21, 1983 0:00:00");
      var end = new Date("July 21, 1983 00:01:05");
      var difference = (end - start) / 1000;
      var min = Math.floor(difference / 60);
      var sec = difference % 60;
      updateTarget(min, sec);
      var paused = false;
  
  function count() {
          if (paused === false) {
              if (min &gt; 0 || sec &gt; 0) {
                  if (sec === 0) {
                      min--;
                      sec = 60;
                      sec--;
                      updateTarget(min, sec);
                  }
                  sec--;
                  updateTarget(min, sec);
                  var timer = setTimeout(function() {
                      count();
                  }, 1000);
                  if (min === 0 &amp;&amp; sec === 0) {
                      clearTimeout(timer);
                  }
              }
          }
      }
  
      function pause() {
          paused = true;
      }
      function play() {
          paused = false;
          setTimeout(function () {
              count();
          }, 1000);
      }
      function updateTarget(min,sec) {
          var target = document.getElementById("update");
          if (sec &lt; 10) {
              sec = "0" + sec;
          }
          target.innerHTML = min + ": " + sec;
      }
  &lt;/script&gt;
  </code></pre>