title: Add leading zero to Minutes and Seconds in Javascript countdown timer
body: <p>I am trying to add leading zeros to the minutes and seconds in this javascript countdown timer  i cant get the leadingzero function to work.  that extra leadingzero function i added does not seem to be working:</p>
  
  <pre><code> &lt;pre&gt;  &lt;html&gt;
  &lt;head&gt;
  &lt;/head.
  &lt;body&gt;
  
  &lt;p style="font-size:100px;"&gt;
  
  &lt;div id="countdown"&gt;&lt;/div&gt; &lt;/p&gt;
  &lt;div id="notifier"&gt;&lt;/div&gt;
  &lt;script type="text/javascript"&gt;
  
     function display( notifier, str ) {
      document.getElementById(notifier).innerHTML = str;
    }
  
   function toMinuteAndSecond( x ) {
     return Math.floor(x/60) + ":" + x%60;
   }
  
  
  
    function setTimer( remain, actions ) {
      (function countdown() {
     display("countdown", toMinuteAndSecond(remain));         
     actions[remain] &amp;&amp; actions[remain]();
     (remain -= 1) &gt;= 0 &amp;&amp; setTimeout(arguments.callee, 1000);
      })();
   }
  
  function leadingzero(setTimer) {
  
  if  (setTimer &lt; 10 &amp;&amp; setTimer &gt;=0) 
           return '0' + setTimer;
           else
            return setTimer ; }
  
  {
  }
  
    setTimer(600, {
  10: function () { display("notifier", "Just 10 seconds to go"); },
   5: function () { display("notifier", "5 seconds left");        },
   0: function () { display("notifier", "Your access is no longer guaranteed.. you   need    to refresh your page to gain another spot");       }
  });   
  &lt;/script&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;/pre&gt;
  </code></pre>