title: Javascript interval not clearing
body: <p>I have a fairly complex page with lots of ajax calls and subsequent dom manipulation. On one particular call it sets an interval with a time limit(essentially a timer). I have set up <code>clearInterval()</code> everywhere and even in the function but in very particular use cases(it is complex and I can't determine the exact cause and steps to reproduce the defect) .</p>
  
  <pre><code>$(function() {
    window.timer_interval; 
    // ...
  })
  function timer()
  {
      var current = 0; 
      time_limit = 60;                                
      window.timer_interval = setInterval(function() {
          minute = ( "0" +  Math.round(Math.floor((time_limit - current)/60))).slice(-2); 
          seconds = ("0" + ((time_limit - current)%60)).slice(-2); 
  
          $('#timer').html(minute + ":" + seconds);
  
          if (current &gt;= time_limit) {
              clearInterval(window.timer_interval); 
              window.timer_interval = false; 
          }
          current = current + 1; 
      }, 1000);
  }
  </code></pre>
  
  <p>I have used firbug to detect the value for <code>window.timer_interval</code> , it is <code>false</code> and even the condition is satisfied.One thing might be that that a couple of image transfers fail
  (this is possible application behaviour with code written to gracefully degrade). I am developing in Mozilla.</p>