https://i.stack.imgur.com/PpFlB.pngI currently have multiple Arrays containing various inputs
this.listNumber = [
{
"GenericQuestions": [
{
"input": "long",
},
{
"input": "dog",
},
{
"input": "",
}
],
},
{
"GenericQuestions": [
{
"input": "fred",
},
{
"input": "barney",
},
{
"input": "betty",
}
]
}
]
// There can be more Arrays
In the past, I used the getFilter Method to retrieve input results from a single Array
getFilter(index: string | number) { // index being 0
return this.listNumber[index].GenericQuestions.filter((c: { input: any }) => !!c.input).length;
} // returns 2
Now, I am trying to find a way to get the results of all filled out inputs from both Arrays.
I attempted
const flatfile = this.listNumber.flat();
console.log("flatfile", flatfile);
However, it seems to have failed because GenericQuestions are contained within separate objects.