Can the list be filtered based on the value of iseidaCcaa.id?
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 attempted this solution, but unfortunately it's not working as expected:
this.centers = this.centers.filter(element => {
return element.isiedaCcaa.id == 1;
})