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

112
Vistas
How to loop through array first and check and only execute else condition if all if conditions are false
{
    created_time: '2022-04-15T04:51:32+0000',
    message: 'Chapter 31 of BJ Archmage is out\n',
    id: '××××××\'
  },
  {
    created_time: '2022-04-15T04:49:43+0000',
    message: 'Chapter 35 of Second Life on the Red Carpet is out\n',
    id: '×××'
  },
  {
    created_time: '2022-04-14T01:51:41+0000',
    message: 'Damn',
    id: '×××'
  },
  {
    created_time: '2022-03-21T06:48:23+0000',
    message: 'Uncle just got angry3',
    id: '××××'
  },
  {
    created_time: '2022-01-14T11:07:16+0000',
    message: 'High-school Manhwa where mc is bullied at first but becomes stronger.,
    id: '××××'
  }
]

Above is the json I am getting using Facebook api when I try to loop through every message and compare it only compares one loop for the current title I want all the objects in array to loop through if conditions and only execute else condition if all if conditions were false if not then to break j loop there and continue i loop for getting next title and compare it again and so on....

const response = await axios("https://graph.facebook.com/v13.0/××××/feed?limit=5&access_token=×××××××);
 const data = response.data;

for(var i=0;i<2;i++){

//some other codes.
//some other codes.
//some other codes.

    for(var j=0;j<4;j++){
    
              if(data.data[j].message.includes(getchap + " of " + chaptitle)){ //getchap and chaptitle changes every time I loop is executed
             console.log(data.data[j].message);
                   console.log("post exist so skipping");
break;
             }
       
           else{
             console.log("posted");
          axios.post("https://graph.facebook.com/v13.0/××××××);
break;
    }

    
    }
    }
Any help to me beginner would be appreciated. Thanks in advance! 
about 4 years ago · Santiago Trujillo
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