Because forEach accepts only one callback . Since you are calling the asynchronous method inside forEach , you need to check if the whole asyn call has completed
var response = []; myArray.forEach(function(data, index) { data.asyncFunction(function(result) { response.push(result); if(response.length === myArray.length) {
Anoop source share