List into an Array Javascript

HTML

<div id="demo">
</div>
<div class="printOutputs" id="print1">

</div>
<div class="printOutputs" id="print2">

</div>
<div class="printOutputs" id="print3">

</div>
<div class="printOutputs" id="print4">

</div>

CSS

.printOutputs {
  width: 200px;
  height: 400px;
  border: 1px solid red;
  display: block;
}

JavaScript

var array = [];
 var parent = document.getElementById('projectOutputItems');
 var ids = Array.prototype.slice.call(document.querySelectorAll('.printOutputs')).map(function(element) {
   return element.id;
 });
  
 for (var i = 0; i < ids.length; i++) {
   var el = document.getElementById(ids[i]);
   if (i === 1) {}

   var limit = ids.length;

   for (var j = 0; j <= limit; j++) {
     (function(x, el) {
       setTimeout(function() {
         console.log(getTopPos(el));
         if (x === limit) {
           console.log('It was the last one');
         }
       }, 1000 + (3000 * x));
     })(i, el);
   }
 }

 function getTopPos(el) {
   for (var topPos = 0; el != null; topPos += el.offsetTop, el = el.offsetParent);
   return topPos;
 }