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

426
Vistas
getting error " TypeError: Found non-callable @@iterator " even though the array is inerrable

enter image description hereI'm using one of the online JS editor and it is giving me this below error although when I'm consoling the value of initial it is an array so it should iterate. I' not getting what is wrong with it. Thanks in advance for helping.

 let lists = [[1,4,5],[1,3,4],[2,6]];
 let output=[];
 let initial = lists[0]?lists[0]:[]
 output.push(...initial); //giving error here

 for(let i=1; i<lists.length; i++) {
    curr = output;
    next = lists[i];
    j=0;k=0;
    x=0;
    //console.log(j,next,'next')
    while(j<next.length) {
        
        if(next[j]<=curr[x]){
            output.splice(x,0,next[j]);
            j++;
            x++;
        }else{
          if(curr.length>x){
              //k++;
              x++;
          }else{
            output.push(...next.slice(j))
            break;
          }
            
        }
        
     }
  }
 //console.log(output)
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