I have code that looks something like this in javascript:
forloop { //async call, returns an array to its callback }
After ALL of those
Use an control flow library like after
after.map(array, function (value, done) { // do something async setTimeout(function () { // do something with the value done(null, value * 2) }, 10) }, function (err, mappedArray) { // all done, continue here console.log(mappedArray) })