0

I wanted to remove all duplicated object in an array. But it doesn't work

var a = [{name: 'user-test'}, {6: 7}, {6: 7}, {name: 'user-test'}];
    _.uniq(a);

It returns: [{name: 'user-test'}, {6: 7}, {6: 7}, {name: 'user-test'}]
Expected: [{name: 'user-test'}, {6: 7}]

Can anyone give me an answer?

3
  • all items/objects are unique. Commented Nov 11, 2016 at 8:45
  • 1
    200+ rep and cannot search for remove duplicate objects from array underscore ?? Commented Nov 11, 2016 at 8:52
  • 1
    @mplungjan: I feel like an idiot. Of course there's a previous version of this question. Thank you for marking that. Commented Nov 11, 2016 at 8:52

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.