I have have two arrays, I want to merge them into one object. I have given some examples of what I have and what I want to achieve. I tried _.union and few other underscore methods.
var original = [
{
Country: 'US',
value: '10'
},
{
Country: 'Turkey',
value: '5'
}
];
var newlist =["Afghanistan", "Antarctica","Turkey"]
The Results I want:
var results= [
{
Country: 'Afghanistan',
value: '0'
},
{
Country: 'Antarctica',
value: '0'
},
{
Country: 'Turkey',
value: '5'
}
];
The US would not appear in the final results because the newlist doesn't have US. So basically all the values from the new list would appear in the results with the values from the original list.