I have two arrays of objects like this:
var myArray = [
{pk: '1', person: 'person 1'},
{pk: '2', person: 'someone'},
];
var updatedArray = [
{pk: '2', person: 'another person'}
];
I'm looking to merge the two in the most efficient way possible. My thought was to merge the older myArray into the newer updatedArray and leave out any items where myArray.pk == updatedArray.pk
I'm having trouble trying to get it going with either jQuery or underscore. I've been trying to use this one as an example as well.
Any ideas?