Here's my code,I am getting the latLongData array without the Objects. How to resolve it? What could be the possible reason?
let latLongData = [];
async function calcLatLong() {
let Obj = {
loadId: locPoints.loadId,
latLongs: []
};
try {
for (let point of locPoints.loadingUnloadingPoints) {
if (point.location) {
Obj.latLongs.push(await getLatLong(point.location));
}
}
latLongData.push(Obj);
} catch (err) {
throw new Error(err);
}
return latLongData;
}
Even after using for..of
instead of forEach
loop the problem persists.