I'm struggling to find the index of the array that has id === 3.
const id = 3;
const bigList = [
[
{ id: "1", foo: "a" },
{ id: "2", foo: "b" }
],
[
{ id: "3", foo: "c" },
{ id: "4", foo: "d" }
],
[
{ id: "5", foo: "e" },
{ id: "6", foo: "f" }
]
];
I tried this to filter out that array.
const filteredList = bigList.filter(list => list.filter(item => item.id === id))
But it was wrong.
I really appreciate if you show me how it works. Thanks!
indexor all the matched elements in the list?