JSFiddle - React, Tailwind, and code Playground

JavaScript

"use strict";

var filesToLoad = [ 'fileA','fileB','fileC' ];
var promiseArray = [];

for( var i in filesToLoad ) {
  console.log(i)
  promiseArray.push(
    new Promise( function(resolve, reject ) {
      var temp = i;
      setTimeout( function() {
        resolve( filesToLoad[temp] );
      }, Math.random() * 1000 );
    })
  );
}

Promise.all( promiseArray ).then(function(value) {
  console.log(value);
});