0

I have a code like before. Every time I calculate some values I want to save the result into a map since they might be relevant for the next calculation of countQuery. But the map is just empty at every call of countQuery. The map gets values, but after everything is done. Any idea on how to sync this one?

let map = {};
filterItemArray.forEach(async arrayItem => {
  const value = await countQuery(arrayItem.item, map);
  map[arrayItem.key] = value;
});
Safari
  • 3,232
  • 9
  • 42
  • 62

0 Answers0