Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

221
Vistas
wait for the nested loop

!I'm a beginner in js! is there any way to let the return wait for both for loops to finish I tried all the solutions here " https://stackoverflow.com/questions/27914209/how-could-i-run-a-function-after-the-completion-of-a-for-loop-in-node-js" but no one of them works I think because is nested loop even this one How could I run a function after the completion of a for loop in Node.js?


function StatisticsPerGameId (IDs){
    console.log(IDs)
    let doubldoubl={};
    for (let i=0; i <IDs.length;i++){
        const options = {
            method: 'GET',
            url: 'https://api-nba-v1.p.rapidapi.com/players/statistics',
            params: {game: IDs[i]},
            headers: {
              'X-RapidAPI-Host': 'api-nba-v1.p.rapidapi.com',
              'X-RapidAPI-Key': 'afgsdgbsdghbrynhndf6hn6dfhndfhn61dhddfhn'
            }
          };
          
          axios.request(options).then(function (response) {
            console.log(response.data.response[0].points)
            for(let j in response.data.response){
                let dd = 0;
                if( response.data.response[j].points >= 10){dd=dd+1;};
                if( response.data.response[j].totReb >= 10){dd=dd+1;};
                if(dd == 2 ){
                    doubldoubl=doubldoubl+{
                        name:response.data.response[j].player.firstname +" "+ response.data.response[j].player.lastname,
                        teamOfplayer : response.data.response[j].team.name,
                        teamOfplayerlogo:response.data.response[j].team.logo,
                    }
                };
                dd = 0 ;
            }
          }).catch(function (error) {
              console.error(error);
          }); 
    }
    return doubldoubl;
}


about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda