I have next object:
rows = [
{
name: "user1",
previlege: "Filtering"
},
{
name: "user2",
previlege: "Reportering"
},
{
name: "user3",
previlege: "Filtering"
}
]
And another object:
selected = {
name: "user1",
previlege: "Filtering"
}
I want filter rows and delete object which matched, so I need to compare them. I tried like this:
rows.filter(function(object) {
return JSON.stringify(object) !== JSON.stringify(selected);
});
But it doesn`t work. How can I delete this matched object?
JSON.stringify(), though? If you want to filter out the object with the samenameproperty, but it has a differentprevilegeproperty, it wouldn't work.var ans=rows.filter?