Edit in JSRUN

var asyn = function(arr, cb) {
    arr.reduce((p, func) => p.then(func),    Promise.resolve()).then(cb);
};

var funArry = [];
for(var i=0;i<5;i++){
 var n = i;
  var fun = function(n) {
      console.log(n);
      return new Promise(function(resolve) {
          setTimeout(function() {
              console.log('func'+n);
              resolve();
          }, 5000);
      });
  };
  funArry.push(fun);
}
console.log(funArry);
asyn(funArry, function() {
    console.log('all things gets done');
});
<div id='box'></div>