I have an array of objects in this form :
[
{ id:"123", url:"example1.com"},
{ id:"123", url:"example2.com"},
{ id:"456", url:"example3.com"},
{ id:"789", url:"example4.com"},
]
I'm looking for a fast performing way to filter this array to keep only objects with a unique id, in this case, the output should be :
[
{ id:"123", url:"example1.com"},
{ id:"456", url:"example3.com"},
{ id:"789", url:"example4.com"},
]
I'm using a double for loop to compare my objects, but it's painfully slow on a large array... Does anyone have a good solution?
idas the index for the array instead?arr[456] = ...? Presumably id == identifier which is unique