v1
6/21/2022 by rohitjindal -00
Setup HTML - click to add setup HTML
disable setup JavaScript
Setup JavaScript
const clientData = {
  1111 : [
    {ID : 112, name : 'John',age : 23},
    {ID : 113, name : 'Doe',age : 21},
    {ID : 114, name : 'Stan',age : 24},
  ],
  2222 : [
    {ID : 222, name : 'Sara',age : 15},
    {ID : 223, name : 'Wiliams',age : 61},
    {ID : 224, name : 'Alan',age : 45},
  ]
};

const invalidValues = [112, 223, 114];
delete caserun single casemove downdrag and drop case


ready



Object.keys(clientData).forEach(key => {
    clientData[key].forEach((obj, index) => {
    if (invalidValues.includes(obj.ID)) {
        clientData[key].splice(index, 1);
    }
  })
});

console.log(clientData);
delete caserun single casemove updrag and drop case


ready



const idsToDelete = new Set(invalidValues);

const result = Object.keys(clientData).reduce((acc, key) => { 
    acc[key] = clientData[key].filter(({ID}) => !idsToDelete.has(ID));
    return acc;
}, {});

console.log('Result:', result)
Test Case - click to add another test case
Teardown JS - click to add teardown JavaScript
Output (DOM) - click to monitor output (DOM) while test is running
RUN