title: How to open a specific quantity of webpages at preset intervals in JavaScript?
body: <p>I'm relatively new to JavaScript. I would like to have a user click a button, opening a specific webpage (or video in this case) every 3 seconds, for 20 pages. I can't seem to figure out how to do that with any kind of loop without either looping the window.open() (effectively crashing my browser) or causing the webpage to not load at all due to another loop OR causing all the tabs to open at once. Here's what I have so far for JS:</p>
  
  <pre><code>var numberOfVids = 20;
  var vidNumber = 1;
  var website = "http://example.com";
  var myVar;
  
  function executeVidBot() {
       myVar = setInterval(openVid, 3000);
  }
  
  function openVid() {
       window.open(website);
       vidNumber++;
  }
  </code></pre>
  
  <p>And here's my HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;body&gt;
  
  &lt;p&gt;Click the button to execute the VidBot.&lt;/p&gt;
  
  &lt;button onclick="executeVidBot()"&gt;Execute VidBot&lt;/button&gt;
  
  &lt;script src="vidbot.js"&gt;&lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>Any help would be extremely appreciated as I've been looking for a solution for a while and can't seem to find one.</p>