I need to match two array and merge by matching key value using JavaScript/Node.js. Here is my code:
var userData=[{'email':'[email protected]','name':'Raj'},{'email':'[email protected]','name':'Rahul'}];
var userData1=[{'email':'[email protected]','address':'abcdf'},{'email':'[email protected]','address':'bbsr'}];
Here I have two array and I need to merge both array by matching the email
value and the expected output is like below.
var finalArr=[{'email':'[email protected]','name':'Raj','address':'abcdf'},{'email':'[email protected]','name':'Rahul','address':'bbsr'}];