I have two list of objects and I need to remove all duplicates, something like this:
INPUTS var array1 = [(1, 'banana', 'yellow'), (1, 'apple', 'red'), (1, 'orange', 'orange')]; var array2 = [(1, 'banana', 'yellow'), (1, 'apple', 'red'), (2, 'grapes', 'purple')];
OUTPUT array1 = [(1, 'orange', 'orange')]
I tried using filter but it doesn't work for objects :(
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I have two list of objects and I need to remove all duplicates, something like this:
INPUTS
var array1 = [(1, 'banana', 'yellow'), (1, 'apple', 'red'), (1, 'orange', 'orange')];
var array2 = [(1, 'banana', 'yellow'), (1, 'apple', 'red'), (2, 'grapes', 'purple')];
OUTPUT
array1 = [(1, 'orange', 'orange')]
I tried using filter but it doesn't work for objects :(