I have this array
var selectedId = [
"12",
"22"
];
var allData = [{
"id": "12",
"title": "Title 1",
"description": "description"
},
{
"id": "22",
"title": "Title 2",
"description": "description"
},
{
"id": "25",
"title": "Title 3",
"description": "description"
}
]
I want to check for multiple id using filter function
this.allData.filter((people => people.id=='12'));
for single value it is working but i have both 12
and 22
and i want to get only these two records.
Any solution. Thanks
3
Answers
You can use array.includes()
You can apply this approach:-