title: How to load images from folder by using javascript
body: <p>There are 0.png, 1.png, 2.png, ... in folder images. How to load all them. Number of the images unknown.</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>} while(!img[numOfImages].onerror);
  
  alert("numOfImages = " + numOfImages);
  
  var 
    numOfImages = 0;
    img = []; 
  
  do{
   img[numOfImages] = new Image();
   img[numOfImages].src = "images/" + numOfImages + ".png";
   numOfImages++;
  } while(!img[numOfImages].onerror);
  alert("numOfImages= " + numOfImages);</code></pre>
  </div>
  </div>
  </p>