Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

175
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda