我正在调用函数并将数据推入数组,但数组为空
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
})
请帮助我任何人解决