array = [{id:"1", name:"Jhon"},
{id:"2", name:"Kabir"},
{id:"3", name:"Rasel"}];
console.log(remove_by_id( array, '2' ));
function remove_by_id( array, id ) {
const index = array.findIndex( el => el.id === id );
if( index !== -1 )
array.splice( index, 1 )
return array;
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…