I have an array of object how can I get those objects having duplicate attribute value.
var array = [{"id":1,"attr":5},{"id":2,"attr":3},{"id":3,"attr":5}];
Here it should return array[0]
and array[2]
because these elements having duplicate attribute value (attr=5).
and also return unique array.
array = [{"id":2,"attr":3}];