title: My image slide continues incrementing after the last index in my images array
body: <pre><code>var i = 0;
  var tm = 5000;
  var images = []; 
  images[0] = &quot;img1.png&quot;
  images[1] = &quot;img2.png&quot;
  images[2] = &quot;img3.png&quot;
  function imageslide() {
    document.myslide.src =
      images[i]
    if (i &lt; images.length) {
      i++
    } else { i = 0 }
    setTimeout(&quot;imageslide()&quot;, tm)
  }
  window.onload = imageslide;
  </code></pre>