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

132
Views
Cómo reescribir este "bucle asíncrono para" usando "mapa"

Estoy tratando de reescribir este ciclo asíncrono usando el mapa pero no puedo lograr el resultado deseado

 const wait = (ms) => new Promise((r) => setTimeout(r, ms)); const numbers = [1, 2, 3, 4, 5]; const loop = async() => { for (const number of numbers) { console.log(number); await wait(500); } }; loop();

Pero cuando intento:

 const wait = (ms) => new Promise((r) => setTimeout(r, ms)); const numbers = [1, 2, 3, 4, 5]; const loop = async() => { numbers.map(async(number) => { console.log(number); await 500; }); }; loop();

¡Da un comportamiento de sincronización!

Me puedes decir donde esta el error por favor

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!