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

111
Views
Espera sin esperar a que otras esperas terminen en la función Async

Aprendiendo un poco de JS y teniendo un problema en un proyecto en el que he estado trabajando. Tengo 2 funciones forEach en las que la segunda se basa en la primera para una variable. Quiero esperar a ambos para que el segundo solo se ejecute una vez que el primero forEach haya terminado. Esperaba algunos consejos (sé que esta no puede ser la forma más eficiente de hacerlo jajaja)

 // test data to show structure const staff = [{ steamid: 'STEAM_0:1:1111111', server: 'testing'}]; const setStaffInfo = async function () { try { await staff.forEach(async (item) => { // this getSteamID64 is a fetch to convert steamID to steamID64 // this works fine const steamid64 = await util.getSteamID64(item.steamid); if (steamid64) item.steamid64 = steamid64; }); // PROBLEM! I believe this is running before the steamid64 is set in the prior forEach function await staff.forEach((el) => { if (el.server === "testing" && el.steamid64) { el.sits = 5; } }); } catch (err) { console.log(err); } };

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!