title: Stopwatch I made using JS not working
body: <p>I've run the code multiple times trying to fix any error I have found in the code but it just doesn't seem to work.</p>
  
  <p>I'm using the <em>setInterval()</em> loop. The function does not even run once. What could the problem be?</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function stopWatch () {
  
    var hours = Number(document.getElementById('hours').innerHTML);
    var minutes = Number(document.getElementById('minutes').innerHTML);
    var seconds = Number(document.getElementById('seconds').innerHTML);
  
    if (seconds&lt;60) {
      seconds++
    } else {
      seconds = 0;
      minutes++
    }
  
    if (minutes == 60) {
      minutes = 0;
      hours++
    }
  
    if (seconds.length==2) {
      document.getElementById('seconds').innerHTML = seconds;
    } else {
      document.getElementById('seconds').innerHTML = '0' + seconds;
    }
  
    if (minutes.length==2) {
      document.getElementById('minutes').innerHTML = minutes;
    } else {
      document.getElementById('minutes').innerHTML = '0' + minutes;
    }
  
    if (hours.length==2) {
      document.getElementById('hours').innerHTML = hours;
    }
  
    if (hours.length==1) {
      document.getElementById('hours').innerHTML = '0' + hours;
    }
    
   }
  
  setInterval(stopWatch,1000)</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;html&gt;
  &lt;head&gt;&lt;/head&gt;
  &lt;body&gt;
      &lt;p&gt;
          &lt;span id='hours'&gt;00&lt;/span&gt;:&lt;span id='minutes'&gt;00&lt;/span&gt;:&lt;span id='seconds'&gt;00&lt;/span&gt;
      &lt;/p&gt;
  &lt;/body&gt;
  &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p>