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

114
Views
¿Cómo puedo guardar muchas Fetchs en una matriz?

Estoy usando PokeApi y quiero guardar datos que están dentro de otra API usando sus ID, pero podría ser más de 1, así que quiero guardarlos en una matriz. Por ahora estoy usando dos métodos, uno obtiene la API y verifica si la información está allí.

 const evolutionChain = async (URLEC)=> { var chain=[] const getURL= await fetch(URLEC); const res1 = await getURL.json(); chain.push(getPoke(res1.chain.species.url)); if(res1.chain.evolves_to.length!==0){ chain.push(getPoke(res1.chain.evolves_to[0].species.url)); } if(res1.chain.evolves_to[0].evolves_to[0].length!==0){ chain.push(getPoke(res1.chain.evolves_to[0].evolves_to[0].species.url)); } return chain; }

URLEC es "https://pokeapi.co/api/v2/evolution-chain/1/".

Y la otra función obtiene la otra URL y obtiene la información.

 const getPoke= async (url)=>{ const getURL= await fetch(url); const res1 = await getURL.json(); const res2 = await fetch( `https://pokeapi.co/api/v2/pokemon/${res1.id}`); const res3 = await res2.json(); const poke= { name: res3.name } return poke; }

Al final me devuelve la promesa completa que tiene una serie de promesas como esta: Resultados

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!