I am in search of a way to determine whether my array contains duplicate object values or not. Let's say I have the following array of objects:
const array = [
{
id: "id1",
quantity: 3,
variation: "red",
tax: 40
},
{
id: "id1",
quantity: 3,
variation: "red",
tax: 40
},
{
id: "id2",
quantity: 3,
variation: "red",
tax: 40
}
]
In this case, the expected output should be true as the id1
appears twice in the array. If all IDs are unique throughout the array, then the expected output should be false. I have been struggling to find a suitable solution for this. Can someone guide me on how to achieve this?