title: JavaScript Loop only works once
body: <pre><code>var block = [];
  
  setInterval(function() {
  
  block.push(document.createElement(&quot;div&quot;));
  for (let i = 0; i &lt; block.length; i++) {
  </code></pre>
  <blockquote>
  <p>I made a class in css that has some stylings</p>
  </blockquote>
  <pre><code>block[i].setAttribute(&quot;class&quot;, &quot;block&quot;);
  document.body.appendChild(block[i]);
  
  }}, 1000);
  </code></pre>