for example, Suppose I have a 2d array:

```
let filterArr=[
  [1,1,0,1,1],
  [0,1,1,1,0],
  [1,1,0,1,0]
];

```

I want to find and store the index of column that all are 1, i.e.:position 1 and 3, and the codes are the following:

Use Array:

```
let filterArr=[
  [1,1,0,1,1],
  [0,1,1,1,0],
  [1,1,0,1,0]
];

let results=[];
for(let i=0;i<filterArr[0].length;i++){
  let isAllOne=true;
  for(let filter of filterArr){
    if(filter[i]!=1){
      isAllOne=false;
      break;
    }
  }
  if(isAllOne){
    results.push(i);
  }
}
//store results for other use

```

Use Set:

```
let filterArr=[
  [1,1,0,1,1],
  [0,1,1,1,0],
  [1,1,0,1,0]
];

let results=new Set();
for(let i=0;i<filterArr[0].length;i++){
  let isAllOne=true;
  for(let filter of filterArr){
    if(filter[i]!=1){
      isAllOne=false;
      break;
    }
  }
  if(isAllOne){
    results.insert(i);
  }
}
//store results for other use

```

Which I found "results" can be either Array or Set. My question is, not limited to this case, if I found both Array and Set can finish my task, should I use Array or Set?