The following will:
- create a new array that contains all the elements of c1 and c2. See union.
- from that mix, create a new array that contains only the unique elements. See uniq.
Note that this would work only if all your objects have the property a
.
_.uniq(_.union(c1, c2), false, function(item, key, a){ return item.a; });
You can find other options in this question.