title: stop a countdown timer after a certain time
body: <p>I have a js countdown timer (Author: ricocheting.com) that counts down to a certain date. It executes like so</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>window.onload = function() {
        var cdown = new CDown();
  
        cdown.add(new Date(2015, 8, 06, 15, 55, 00), "countdown-holder");
      };</code></pre>
  </div>
  </div>
  </p>
  
  <p>The countdown timer is part of an ad I'd like to run on google ads but google had a 30s limit on the ads, so I'd like to run the countdown for at least those 30 seconds and then make it stop and disappear.</p>
  
  <p>Being a complete and total newbe to coding, the code is a maze for me though I understand that the init function is making the whole countdown work</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>init: function() {
          this.state = 1;
          var self = this;
          this.interval = window.setInterval(function() {
            self.tick();
          }, 1000);
        },</code></pre>
  </div>
  </div>
  </p>
  
  <p>I also figured out that the clearTimeout() stops the countdown</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>window.clearTimeout(this.interval);</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now after searching the net I know there is the setInterval() function that can stop a function from executing after a certain amount of time, so I've tried to put the window.clearTimeout(this.interval) code inside a set interval function but that doesn't seem to work :(</p>
  
  <p>Any help would be appreciated. Thank you!</p>