0

I have array of object like this :

var myArr = [
    {"id": 1, "name": "john"},
    {"id": 2, "name": "frank"},
    {"id": 1, "name": "john"},
    {"id": 3, "name": "andrey"}
];

if there is the same object then shown one, like this :

var myArr = [
    {"id": 1, "name": "john"},
    {"id": 2, "name": "frank"},
    {"id": 3, "name": "andrey"}
];

anyone please help me. thanks.

Phil
  • 157,677
  • 23
  • 242
  • 245
andrew MK
  • 13
  • 6
  • What would be a formal definition for the "same"? – zerkms Aug 30 '16 at 04:06
  • in array myArr contained in the same object, namely {"id": 1, "name": "john"}, if there is the same object then it is only shown once. – andrew MK Aug 30 '16 at 04:49
  • "same object" in JS is not what you think. In your examples all those are independent different objects. That's why I asked you to formalise it. But anyway, in the duplicates everything is explained clearly. – zerkms Aug 30 '16 at 04:52

0 Answers0