Skip to content

Instantly share code, notes, and snippets.

@tarzak
Created January 12, 2015 11:34
Show Gist options
  • Save tarzak/8e3f4c719f87da698ba8 to your computer and use it in GitHub Desktop.
Save tarzak/8e3f4c719f87da698ba8 to your computer and use it in GitHub Desktop.
function compare(arr1, arr2) {
for(var i = 0; i < arr1.length; i += 1) {
for(var j = 0; j < arr2.length; j += 2) {
if (arr1[i].id === arr2[j].id) {
arr1.splice(i,1,arr2[j]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment