I have the following object table :
let data = [
{key:"20-09-2019", skill: [{id: 500, message: "monday"}, {id: 501, message: "tuesday"}]},
{key:"21-09-2019", skill: [{id: 502, message: "thursday"}, {id: 503, message: "sunday"}]},
{key:"22-09-2019", skill: [{id: 504, message: "sunday"}]},
]
let search = "sun"
I would like to filter the table if the value of "message" match with the value of "search"
if search = "sun" the filter should return the following result:
result after filter :
data = [
{key:"21-09-2019", skill: [ {id: 503, message: "sunday"}]},
{key:"22-09-2019", skill: [{id: 504, message: "sunday"}]},
]
here the array only returns the objects having the message value that match with "sun"
I know the filter method but I do not think we can do a filter in a filter.
I also know the method that allows me to match the message :
message.toLowerCase().includes(search);
but I do not know how to filter the object array, if anyone has an idea?