i have array like this
var listShow = [1, 3]
and this
[
{
id: 1,
name: 'JOHN',
},
{
id: 2,
name: 'JOHNE',
},
{
id: 3,
name: 'JOHNW',
}
]
And I only want to return array if id value is same as above array, I want result like this
[
{
id: 1,
name: 'JOHN',
},
{
id: 3,
name: 'JOHNW',
}
]
Does anyone know how to make the above possible? I've tried using array.filter but it doesn't work
array.filterdoesn't work. Please can you explain how it doesn't work? Perhaps show us the code you've tried?