i have an array like this.
0: {id: 4, country: Japan},
1: {id: 5, country: Korea},
2: {id: 6, country: Philippines},
3: {id: 6, country: Philippines}
How can I remove both record with the same id? so the returned data should look like this.
0: {id: 4, country: Japan},
1: {id: 5, country: Korea}
How can i fix this? I tried the methods described in a specific topic here but it didn’t work
3
Answers
For each element of the array if there are elements equal to it, it is marked as "to be removed" and meanwhile the equal elements are removed. The i element is removed at the end.
this is another way to do that