title: Checking in loop if image exist and actualisation
body: <p>I have an array <code>imglist</code> which contains images paths.</p>
  
  <p>The below code checks existence of an image and if not found change a style of numB to: display none. </p>
  
  <pre><code>var nums = [];
  var imgc;
  var imgnumb = imglist.length;  
  for( var d = 1; d &lt;= imgnumb; d++ ) {  
        imgc = document.createElement('img'); 
        imgc.src = imglist[d];
        imgc.onerror = function() {
        alert(d);
        nums[d] = parseInt(document.getElementById("numB"+d).setAttribute("style", "display:none"));
  }}
  </code></pre>
  
  <p>My code is not working and I can't find any problem. Please help me in fixing the error.</p>