I'm calling function and return data push into an array but array is empty
property.forEach(function(proObj){
var photo=[];
proObj.photosId.forEach(function(Pid){
fileUpload.fetchPhotoById(Pid,function(photoObj){
photo.push(photoObj); //photo obj is added to photo Array
console.log('source:-'+photoObj); // getting data correctly
})
})
proObj.photos=photo;
console.log('Photo Array'+photo); // photo has default value means empty array
})
Please help me anyone to resolve