This is my JSON response . I am able to splice out elements from controller side using something like this . Now comes a situation where my employees can have same employee id but different Type . So i would like to remove itesm from the response by comparing both Id & type. For example I need to remove the emplooyee with Id ABC and type D only . How can i splice them out how can i proceed
var searchresponse = [{
"items": [{
"employeeId": "ABC",
"type": "D",
"alive": "Yes"
}, {
"employeeId": "ABC",
"type": "P",
"alive": "Yes"
}, {
"employeeId": "NPK",
"type": "D",
"alive": "Yes"
}, {
"employeeId": "PKN",
"type": "A",
"alive": "Yes"
}],
"more": false
}];
var data1 = ["ABC"];
var data2 = ["D"] //- how to splice ABC also comparing the D
var items = searchresponse[0].items;
for (var i = items.length - 1; i >= 0; i--) {
if (data1.indexOf(items[i].employeeId) != -1) {
items.splice(i, 1);
}
}