I'm trying to find out selected object index from array
But it always return -1 don't know why?
Here is I'm trying to do
I have following array in which their are multiple objects
var data = [{
  "name": "abc",
  "age": 25,
  "school": "xyz pqr"
},
{
  "name": "abc1",
  "age": 26,
  "school": "xyz pqr"
},
{
  "name": "abc2",
  "age": 27,
  "school": "xyz pqr"
}]
And here is my another array that are selected by user
var dList = [{
  "name": "abc",
  "age": 25,
  "school": "xyz pqr",
  "isChecked": true
}]
Now I want to find out selected object index from data array and remove this object from that array
if (dList.length > 0) {
  for (let i=0; i<dList.length; i++){
    delete dList[i]['isChecked']
    console.log(dList[i])
    console.log(data[0])
    console.log(dList[i] == data[0])
    let index = data.indexOf(dList[i]);
    console.log(index)
    data.splice(index, 1);
  }
}
 
     
     
     
     
     
     
     
    