Is it possible to filter this list where iseidaCcaa.id is equal to a given number:
var centers = [
{
id: 2,
nombre: "Centro 2",
iseidaCcaa: {
id: 1,
},
},
{
id: 3,
nombre: "Centro 3",
iseidaCcaa: {
id: 1,
},
},
{
id: 1,
nombre: "Centro 1",
iseidaCcaa: {
id: 2,
},
},
];
I tried this solution but it is not working
this.centers = this.centers.filter(element => {
return element.isiedaCcaa.id == 1;
})