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

172
Views
i made a map with fetch and split the result, and push to other variable but when i try to acess it return undefined - array[0] = undefined

i made a map with fetch and split the result, and push to other variable but when i try to acess it give's undefined

const arrayPokemons = Array(5)
  .fill()
  .map((item, index) => {
    let hold = [];
    fetch(`https://pokeapi.co/api/v2/pokemon/${index + 1}`)
      .then((res) => res.json())
      .then((data) => {
        hold.push(data.name.split(""));
      });

    console.log(hold, " INTO THE MAP");
    return hold;
  });

console.log(arrayPokemons, "ALL ARRAYS");
console.log(arrayPokemons[0], "SPECIFC ARRAY");
console.log(arrayPokemons[0][0], "SELECTED ARRAY, BUT RETURN undefined");

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!