Array filter using function
const list = [
{
id: 1,
name: 'Steve',
email: '[email protected]',
},
{
id: 2,
name: 'John',
email: '[email protected]',
},
{
id: 3,
name: 'Pamela',
email: '[email protected]',
},
{
id: 4,
name: 'Liz',
email: '[email protected]',
},
];
const removeuser = (list,name) => {
return list?.filter(item => item?.name !== name)
}
console.log('filter user -->', removeuser(list,'John'));