To remove Random object we need Index Number of that object -
//here Vasu is array name -
var index = vasu.findIndex(x => x._id === "1"); // find Index by Property & its value
console.log(index)
if (index >= 0) {
vasu.splice( index, 1 ); //1st parameter is Index number & 2nd is Remove count
}
Comments
Post a Comment