public
Created

  • Download Gist
array of unique objects.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
function games_union (arr1, arr2) {
var union = arr1.concat(arr2);
for (var i = 0; i < union.length; i++) {
for (var j = i+1; j < union.length; j++) {
if (are_games_equal(union[i], union[j])) {
union.splice(i, 1);
console.log(union[i]);
}
}
}
}
function are_games_equal(g1, g2)
{
return g1.title === g2.title;
}
 
console.log(games_union(temp, temp2);

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.