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

156
Views
for of loop devuelve el mismo elemento varias veces api double fetch

La consola y el navegador muestran esto . En el primer ciclo, obtengo 10 resultados diferentes como se esperaba. en el segundo bucle for cuando lo llamo me da 10 veces el mismo resultado. ¿Por qué sucede esto y cómo lo soluciono?

 const inputValue = document.getElementById("searchbarInput").value; const searchUrl = `https://stock-exchange-dot-full-stack-course-services.ew.r.appspot.com/api/v3/search?query=${inputValue}&limit=10&exchange=NASDAQ`; const options = { filter: '', sort: 1} async function displaydata() { let url = searchUrl; let response = await fetch(url); let data = await response.json(); //log company info const mappedList = data.map((x) => ({ name: x.name, symbol: x.symbol, ceo: x.ceo })) for (let info of mappedList) { const companyInfo = await fetchMoreInfo(info.symbol); ceo = companyInfo.profile.ceo; // here returns a 10 different items } document.getElementById('root').replaceChildren(); for (comp of mappedList) { const div = document.createElement('div'); div.innerHTML = `<a href="/company.html?symbol=${comp.symbol}">${ceo} ${comp.name}(${comp.symbol})</a>` + "<br>"; document.getElementById('root').appendChild(div); //here it gives me the same 10 itmes}} const fetchMoreInfo = async(companySymbol) => { let url = `https://stock-exchange-dot-full-stack-course-services.ew.r.appspot.com/api/v3/company/profile/${companySymbol}`; let response = await fetch(url); let compData = await response.json(); return compData;

}

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!