const arr = [
{
title:"Title 1",
values:[1,2,3],
children:[
{
title:"Subtitle 1"
values:[1,3]
}
]
},
{
title:"Title 2",
values:[1,3],
children:[
{
title:"Subtitle 2"
values:[1,3]
}
]
}
]
I wanna output like this
[
{
"title": "Title 1",
"values": [1,2,3],
"children": []
}
]
arr.filter(item => item.values.includes(2))
This is not working the way I want.
const arr = [
{
title:”Title 1″,
values:[1,2,3],
children:[
{
title:”Subtitle 1″
values:[1,3]
}
]
},
{
title:”Title 2″,
values:[1,3],
children:[
{
title:”Subtitle 2″
values:[1,3]
}
]
}
]
I wanna output like this
[
{
“title”: “Title 1”,
“values”: [1,2,3],
“children”: []
}
]
arr.filter(item => item.values.includes(2))
This is not working the way I want.