title: How to increase setInterval timer in loop
body: <p>Here i have a countdown script.</p>
  
  <p>It decreases the number after 1 second. What i want to create is a loop where it increase the time of setInterval when decreasing the number.</p>
  
  <p>For example it shows 9 copies left after 1 second, then 8 copies left after about 5 seconds, then 7 copies left after 15 seconds and so on until it reaches one.</p>
  
  <pre><code>var count=10;
  var counter=setInterval(timer, 1000);
  
  function timer()
  {  
    count=count-1;
    if (count &lt;= 0)
    {
       clearInterval(counter);
       //counter ended, do something here
       return;
    }
  
    document.getElementById("timer").innerHTML="Only " + count + " copies left! Hurry up!";
  }
  </code></pre>
  
  <p>Here is my code: <a href="https://jsfiddle.net/guraqwnd/" rel="nofollow">jsfiddle</a></p>