I have an array of such objects -
var arr = [ { type_id: "3", full_empty:"true", quantity:1}, { type_id: "3", full_empty:"true", quantity:1}, { type_id: "9", full_empty:"true", quantity:4}, { type_id: "9", full_empty:"false", quantity:4}, { type_id: "9", full_empty:"true", quantity:4}, { type_id: "9", full_empty:"true", quantity:4}, { type_id: "9", full_empty:"true", quantity:4} ];
I want to remove duplicates with the same type_id and full_empty values . The result should look like this:
var arr = [ { type_id: "3", full_empty:"true", quantity:1}, { type_id: "9", full_empty:"true", quantity:4}, { type_id: "9", full_empty:"false", quantity:4}, ];
I searched and found some solution, but some of them are designed to remove duplicate keys or to remove duplicates based on the duplicate value of only one key. Some required external libraries. There are also some solutions that I cannot understand. Is there an easy way to do this in simple JavaScript?
Edit for a better understanding . I read this question . The accepted answer to this question is to find duplication for only one key. In my case, I have to find duplication for several keys.