Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript union of two object [duplicate]

I have one object:

Object { name: " ", email: " " }

and another:

Object { name: Array[x], email: Array[y]}

and I want union like:

Object { name: {" ", Array[x]}, email: {" ", Array[y]} }
like image 933
Raphael Boukara Avatar asked Jan 21 '14 09:01

Raphael Boukara


People also ask

Does concat remove duplicates?

concat() can be used to merge multiple arrays together. But, it does not remove duplicates.

How do you merge duplicate values in an array of objects?

To merge duplicate objects in array of objects with JavaScript, we can use the array map method. to merge the items with the label value together. To do this, we get an array of labels without the duplicates with [... new Set(data.


1 Answers

You could use jQuery.extend to achieve your desire.

like image 78
viebel Avatar answered Sep 20 '22 21:09

viebel