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

185
Views
Not appending empty cell in the first element of 2d array dynamically

I have created a function which will download excel. The scripts works perfectly fine. However, I am trying not to append "hello" in my temp array which is aoa

scripts and logic i came with are shown as below

        var aoa = new Array();
        for (let i = 0; i < filters.length; i++) {
        ..
        ..    
              for(let a = 0; a < filters[i].getAppliedValues().length;a++){ 
                    if(!aoa[a]) aoa[a] = ['Hello'];
                    aoa[a][i] = filters[i].getAppliedValues()[a].formattedValue;
                }
        ..
        ..    
        }

i have simplified my scripts on how i have declared my function .

The result i get is as shown in below image enter image description here

I have tried different approach on declaring if(!aoa[a]) aoa[a] = ['Hello']; but this will only return me an empty cell in the first column/row instead of not appending those into my temp array.

I believed the logic I declared on if(!aoa[a]) aoa[a] = new Array(); is wrong, anybody has any advice on what approach should I go with ?

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!