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

136
Views
¿Cómo uso async await en un bucle for normal?

Tengo una función que acepta un juego encontrado en una base de datos mongodb a través de mongoose y la cantidad de bots para agregar al objeto del juego. el problema es que después de ejecutar la función, solo se guarda un objeto de bot en el documento, aunque numOfBots es 3

 async function addBot(game, numOfBots){ for(index = 0; index < numOfBots; index++){ let bot = {nickName: "Bot"} game.players.push(bot) game = await game.save() } return game } // elsewhere in another async function await addBot(game,3)

¿Cómo puedo usar async await correctamente en un bucle for regular?

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!