I need merge two arrays of objects
, and no duplicates, with es6
syntax. In my task few more keys in objects.
But I think this is not problem. In array2
always objects that are contained inside array1
Here is the array
array1 = [
{name: 'one', count: 0},
{name: 'two', count: 0},
{name: 'three', count: 0},
{name: 'four', count: 0}
]
array2 = [
{name: 'two', count: 4},
{name: 'four', count: 2}
]
I need get this:
array3 = [
{name: 'one', count: 0},
{name: 'two', count: 4},
{name: 'three', count: 0},
{name: 'four', count: 2}
]