I have this function that should list the strings of available games into the activeGames array. When I log the array it returns empty, however, if I set a 1 second time out it will log correctly. Why is this happening?
let activeGames = []
const getActiveGames = async () => {
  const res = await fetch(someUrl)
  const data = await res.json()
  const list = data.content.filter(game => (
    game.aggregatorId === 'someString'
  ))
  activeGames = list.reduce((a, c) => {
    if (!a.includes(c)) {
      return [...a, c.gameId]
    } 
  }, [])
}
getActiveGames()
console.log(activeGames);
// []
