Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

163
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!