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

411
Views
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
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!