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

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 ?