I have an array like this
{
[
{
"id": 1,
"name": "this is book",
},
{
"id": 2,
"name": "this is a test book",
},
{
"id": 3,
"name": "this is a desk",
}
]
}
Now, for example, I want to return an array that contains the word book
I have tried the following but failed -
let test = this.pro.filter((s: { name: any; })=>s.name===book);
I also tried this but it returned the first matching result
instead of all matching results
-
let test = this.pro.filter((s: { name: any; })=>s.name===this is book);
Please help with a solution that can yield an array with all items that match the filter condition/s.