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

119
Views
Saving For Each results in differents var

im trying to generate multiples arrays with one function, i have a For loop so i can save the results of my forEach in differents arrays, but after i=2 my function do not work. Any Ideas?

for (let i=0; i<4;i++){
    if(i==0){
        tempArray=arrayzero;
        console.log(tempArray)
        rotateGrid(tempArray);
    }else if(i==1){
        arrayone=newDecriptorGrid;
        tempArray=arrayone
        console.log(arrayone);
        rotateGrid(tempArray);
    }else if(i==2){
        arraytwo=newDecriptorGrid;
        tempArray=arraytwo;
        console.log(arraytwo);
        rotateGrid(tempArray);
    }
    
}


function rotateGrid(gridToTurn){
    gridToTurn.forEach((element,index) => {
        newElement[index]=[];
        newElement[index][x] = (gridSize + 1) - element[y];
        newElement[index][y] = element[x];
        
        newDecriptorGrid[index] = newElement[index];
    }); 

}  
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!