title: clearInterval stopping setInterval working purely time based
body: <p>I'm newbie in JS/jQuery, and got quite confused about the usage of stopping a setInterval function from running in x ms (or after running X times), which apparently happens with clearInterval. I know this question was asked similarly before, but couldn't help me.</p>
  
  <p>As you see, it starts with 1000ms delay, and then repeat for 9000ms (or after running 3 times if better??), and then it needs to stop. What's the most ideal way of doing this? I couldn't properly use the clearInterval function. Thanks for the answers!</p>
  
  <pre><code>var elem = $('.someclass');
  
  setTimeout(function() {
      setInterval(function() {
          elem.fadeOut(1500);
          elem.fadeIn(1500);
      },3000);
  },1000);
  </code></pre>