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

127
Vistas
I am trying to skip first 2 entries and tha frist 4 and than first 6 like this... up too so on, currently i am using for of loop

I am working with JSON data with for-of loop how can I do and one more point what if the last entry is single like


my js code:
var counter=0,temp=2;
function load() {
  fetch("https://jsonplaceholder.typicode.com/photos")
    .then(function (response) {
      return response.json();
    })
    .then((response) => {
    for (var [index,value] of response.entries()) {
      alert(value);
        if(index < temp){
          var wrapper = document.createElement("div");
          var img = document.createElement("img");
          var title = document.createElement("h6");
          img.src = value.url;
          title.innerHTML = value.title;
          wrapper.setAttribute("class", "wrapper");
          img.setAttribute("class", "img-class");
          title.setAttribute("class", "title");
          wrapper.appendChild(img);
          wrapper.appendChild(title);       document.getElementById("main").appendChild(wrapper);
          index++;
        }else{
          index = index;
          counter = counter + 2;
          temp=counter;
          break;
        }
      }
    });
}
}
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