title: Detect the seconds in a millisecond interval
body: <p>The second parameter in the setInterval function is for delaying the executing in milliseconds. and as expected 1000 millisecond will trigger the function every second. but here's a strange thing that I don't really understant. In the second interval, I've set the delay parameter to 1 millisecond and put inside the function incremental number and condition to check for every passed 1000 number.. I was expecting it to behave just like the seconds interval timer. but It doesn't quite run as I hoped.</p>
  
  <p>Is there any explanation for that?</p>
  
  <pre><code>// detect seconds in a second interval timer (works as expected)
  setInterval(function() {
      console.log('passed second from the secondInterval');
  }, 1e3);
  
  // detect seconds in a millisecond interval timer (I don't have any explanation for the behavior).
  (function() {
      var i = 0;
      setInterval(function() {
          if (i === 0) {
              i++;
              return;
          }
  
          if (i % 1000 === 0) console.log('passed second from the millisecondInterval');
          i++;
      }, 1);
  })();
  </code></pre>
  
  <p>check out the example in jsfiddle to see what I mean
  <a href="http://jsfiddle.net/dwh82zos/" rel="nofollow">http://jsfiddle.net/dwh82zos/</a></p>