Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
async Function returns Promise { <pending> },

so im trying to get some data to the client side, but it is arriving empty, since everytime i try to get the data returned from the fetch its giving Promise { }.

Also, this async map function is inside of another async function called default, if that helps.


async function default(){


const result = last10Matches.map(async (match) => {
      const matchurl = `https://api.pubg.com/shards/${playerPlatform}/matches/${match.id}`;
      const matchresponse = await fetch(matchurl, options);
      const matchdata = await matchresponse.json();

      matchdata.included.forEach((player) => {
        if (
          player.type == 'participant' &&
          player.attributes.stats.name == playerName
        ) {
          playerRecentStats.push({
            kills: player.attributes.stats.kills,
            dmgDone: player.attributes.stats.damageDealt,
            knocks: player.attributes.stats.DBNOs,
            date: matchdata.data.attributes.createdAt,
          });
        }
      });
      // console.log(playerRecentStats); // This does log the correct data here.

      return playerRecentStats;
    });

    console.log(result); // This here returns   Promise { <pending> }

/*
// i Also tried this below. with an empty result whatsoever.
async () => {
      console.log(await result);
    };
*/

}

Thanks in advance

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda